From: Dan Brook Date: Fri, 9 Apr 2010 22:27:57 +0000 (+0100) Subject: Fixed src and dst in diff data for files that had been added/deleted/etc. X-Git-Tag: 0.000006~5 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=3a58f004e86fccfa384065e6da7d268917afb1b8;p=catagits%2FGitalist.git Fixed src and dst in diff data for files that had been added/deleted/etc. * Added a link to the diff of a commit in the commit action. * Tidied up the "path" stuff in the tree action which is no longer used. --- diff --git a/lib/Gitalist/Controller/Fragment/Ref.pm b/lib/Gitalist/Controller/Fragment/Ref.pm index b4a2181..e537896 100644 --- a/lib/Gitalist/Controller/Fragment/Ref.pm +++ b/lib/Gitalist/Controller/Fragment/Ref.pm @@ -52,7 +52,6 @@ after tree => sub { $c->stash( tree => $tree, tree_list => [$repository->list_tree($tree->sha1)], - path => $c->stash->{filename}, # FIXME? ); }; diff --git a/lib/Gitalist/Git/Object/Commit.pm b/lib/Gitalist/Git/Object/Commit.pm index 7ac568b..0445999 100644 --- a/lib/Gitalist/Git/Object/Commit.pm +++ b/lib/Gitalist/Git/Object/Commit.pm @@ -128,7 +128,7 @@ class Gitalist::Git::Object::Commit next; } - if (/^index (\w+)\.\.(\w+) (\d+)$/) { + if (/^index (\w+)\.\.(\w+)(?: (\d+))?$/) { @{$ret[-1]}{qw(index src dst mode)} = ($_, $1, $2, $3); next } diff --git a/root/_diff.tt2 b/root/_diff.tt2 index 4b217d2..11b4199 100755 --- a/root/_diff.tt2 +++ b/root/_diff.tt2 @@ -7,13 +7,19 @@ [% FOREACH item IN diff %]

diff --git [%# FIXME %] - [% item.a %] - [% item.b %] + [% IF !item.src.match('^0+$') %] + [% item.a %] + [% ELSE %] + [% item.a %] + [% END %] + [% IF !item.dst.match('^0+$') %] + [% item.b %] + [% ELSE %] + [% item.b %] + [% END %]

- -
[% blobs.${loop.index} %]
diff --git a/root/fragment/ref/commit.tt2 b/root/fragment/ref/commit.tt2 index 551d103..8560e1f 100755 --- a/root/fragment/ref/commit.tt2 +++ b/root/fragment/ref/commit.tt2 @@ -38,7 +38,7 @@ [% INCLUDE 'inc/chroma_hash.tt2' sha1 = Commit.sha1.substr(0, 7), hide_sha1_output = 1 %]
Commit
[% Commit.sha1 %] - + diff [% INCLUDE 'inc/chroma_hash.tt2' sha1 = Commit.tree_sha1.substr(0, 7), hide_sha1_output = 1 %]
Tree
diff --git a/root/ref/tree.tt2 b/root/ref/tree.tt2 index b477e0c..6d76c32 100755 --- a/root/ref/tree.tt2 +++ b/root/ref/tree.tt2 @@ -1,8 +1 @@ - [% - IF path; - INCLUDE 'nav/path.tt2' filename = path; - END; - - subinclude('/fragment/ref/tree', c.req.captures, c.req.args.to_path); - %] - +[% subinclude('/fragment/ref/tree', c.req.captures, c.req.args.to_path) %]