Migrate commitdiff action to new model
Zachary Stevens [Sun, 8 Nov 2009 16:20:15 +0000 (16:20 +0000)]
lib/Gitalist/Controller/Root.pm
lib/Gitalist/Git/Project.pm

index 5a75fe7..2c41cd9 100644 (file)
@@ -239,11 +239,11 @@ Exposes a given diff of a commit.
 
 sub commitdiff : Local {
   my ( $self, $c ) = @_;
-
+  $c->stash(current_model => 'GitRepos');
   my $commit = $self->_get_commit($c);
-  my($tree, $patch) = $c->model()->diff(
+  my($tree, $patch) = $c->stash->{Project}->diff(
       commit => $commit,
-      parent => $c->req->param('hp') || '',
+      parent => $c->req->param('hp') || undef,
       patch  => 1,
   );
   $c->stash(
index 60a813b..1845c46 100644 (file)
@@ -289,7 +289,7 @@ The keys for each item will be:
     # XXX Ideally this would return a wee object instead of ad hoc structures.
     method diff ( Gitalist::Git::Object :$commit,
                   Bool :$patch?,
-                  NonEmptySimpleStr :$parent?,
+                  Maybe[NonEmptySimpleStr] :$parent?,
                   NonEmptySimpleStr :$file? ) {
         # Use parent if specifed, else take the parent from the commit
         # if there is only one, otherwise it was a merge commit.