Renamed method.
Zachary Stevens [Thu, 19 Nov 2009 00:54:26 +0000 (00:54 +0000)]
lib/Gitalist/Controller/Root.pm
lib/Gitalist/Git/Object/Commit.pm
t/02git_object.t

index 69517c3..ada78e4 100644 (file)
@@ -394,7 +394,7 @@ sub patches : Local {
     $count ||= Gitalist->config->{patches}{max};
     my $commit = $self->_get_object($c);
     my $parent = $c->req->param('hp') || undef;
-    my $patch = $commit->patch( $parent, $count );
+    my $patch = $commit->get_patch( $parent, $count );
     $c->response->body($patch);
     $c->response->content_type('text/plain');
     $c->response->status(200);
index efd51a9..f3202df 100644 (file)
@@ -23,8 +23,8 @@ class Gitalist::Git::Object::Commit
                                       ],
                          );
 
-        method patch ( Maybe[NonEmptySimpleStr] $parent?,
-                       Int $count?) {
+        method get_patch ( Maybe[NonEmptySimpleStr] $parent?,
+                           Int $count?) {
             $count ||= 1;
             # Assemble the git command.
             # common args:
@@ -35,9 +35,10 @@ class Gitalist::Git::Object::Commit
             } else {
                 push @cmd_args, "-1";
             }
-            # if a parent is specified: hp..h
-            # if not, but a merge commit: --cc h
-            # otherwise: --root h
+            # ref spec:
+            #  if a parent is specified: hp..h
+            #  if not, but a merge commit: --cc h
+            #  otherwise: --root h
             if (defined $parent) {
                 push @cmd_args, "$parent.." . $self->sha1;
             } else {
index d722bb0..a3396fc 100644 (file)
@@ -78,7 +78,7 @@ is($patch->{diff}, '--- a/file1
 ', 'patch->{diff} is correct');
 is($patch->{dst}, '5716ca5987cbf97d6bb54920bea6adde242d87e6', 'patch->{dst} is correct');
 
-is($commit_obj->patch, 'From 3f7567c7bdf7e7ebf410926493b92d398333116e Mon Sep 17 00:00:00 2001
+is($commit_obj->get_patch, 'From 3f7567c7bdf7e7ebf410926493b92d398333116e Mon Sep 17 00:00:00 2001
 From: Florian Ragwitz <rafl@debian.org>
 Date: Tue, 6 Mar 2007 20:39:45 +0100
 Subject: [PATCH] bar
@@ -97,4 +97,6 @@ index 257cc56..5716ca5 100644
 -- 
 1.6.4.2
 
-', 'commit_obj->patch is correct');
+', 'commit_obj->get_patch can return a patch');
+
+like($commit_obj->get_patch(undef, 3), qr!PATCH 2/2!, 'commit_obj->get_patch can return a patchset');