Showing 2 changed files with 18 additions and 0 deletions
+4
lib/Gitprep/Git.pm
... ...
@@ -83,6 +83,9 @@ sub branches {
83 83
   my $start;
84 84
   my $no_merged_branches_h;
85 85
   while (my $branch_name = $self->_dec(scalar <$fh>)) {
86
+    $branch_name =~ s/^\*//;
87
+    $branch_name =~ s/^\s*//;
88
+    $branch_name =~ s/\s*$//;
86 89
     
87 90
     # No merged branch
88 91
     $no_merged_branches_h = $self->no_merged_branch_h($user, $project)
... ...
@@ -95,6 +98,7 @@ sub branches {
95 98
   }
96 99
   @$branches = sort { $a->{commit}{age} <=> $b->{commit}{age} } @$branches;
97 100
   
101
+  
98 102
   return $branches;
99 103
 }
100 104
 
+14
xt/basic.t
... ...
@@ -334,4 +334,18 @@ note 'README';
334 334
   $t->content_like(qr#<a href="http://foo3">http://foo3</a>#);
335 335
   $t->content_like(qr#<a href="http://foo4">http://foo4</a>#);
336 336
   $t->content_like(qr#<a href="http://foo5">http://foo5</a>#);
337
+}
338
+
339
+note 'Branches';
340
+{
341
+  # Page access
342
+  $t->get_ok("/$user/$project/branches");
343
+  $t->content_like(qr/Branches/);
344
+  
345
+  # No merged branch
346
+  $t->content_like(qr/no-merged-branch.*?no_merged/s);
347
+  
348
+  # Marged branch
349
+  $t->content_like(qr/"merged-branch.*?b2/s);
350
+  
337 351
 }