Showing 3 changed files with 11 additions and 2 deletions
+6 -1
lib/Gitprep.pm
... ...
@@ -356,7 +356,12 @@ sub startup {
356 356
             
357 357
             # Compare
358 358
             $r->get('/compare' => sub { shift->render_maybe('/compare') });
359
-            $r->get('/compare/(*rev1)...(*rev2)' => sub { shift->render_maybe('/compare') });
359
+            $r->get(
360
+              '/compare/(:rev1)...(:rev2)'
361
+              => [rev1 => qr/[^\.]+/, rev2 => qr/[^\.]+/]
362
+              => sub { shift->render_maybe('/compare') }
363
+            );
364
+            $r->get('/compare/(:rev2)' => sub { shift->render_maybe('/compare') });
360 365
             
361 366
             # Settings
362 367
             {
+1 -1
templates/branches.html.ep
... ...
@@ -278,7 +278,7 @@
278 278
                           <a href="<%= url_for("/$user/$project/settings") %>" type="submit" class="btn btn-small">Change default branch</a>
279 279
                         % }
280 280
                       % } else {
281
-                        <a class="btn btn-small" href="<%= url_for("/$user/$project/compare/$default_branch->{name}...$bname") %>">
281
+                        <a class="btn btn-small" href="<%= url_for("/$user/$project/compare/$bname") %>">
282 282
                           Compare
283 283
                         </a>
284 284
                         % if ($api->logined($user)) {
+4
templates/compare.html.ep
... ...
@@ -9,6 +9,10 @@
9 9
   my $rev = param('rev2');
10 10
   my $page = param('page') || 0;
11 11
   
12
+  unless ($from_rev) {
13
+    $from_rev = app->manager->default_branch($user, $project);
14
+  }
15
+  
12 16
   # Git
13 17
   my $git = $self->app->git;
14 18