Skip to content

Commit

Permalink
Fixed src and dst in diff data for files that had been added/deleted/…
Browse files Browse the repository at this point in the history
…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.
  • Loading branch information
broquaint committed Apr 9, 2010
1 parent 03686cd commit 3a58f00
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 15 deletions.
1 change: 0 additions & 1 deletion lib/Gitalist/Controller/Fragment/Ref.pm
Expand Up @@ -52,7 +52,6 @@ after tree => sub {
$c->stash(
tree => $tree,
tree_list => [$repository->list_tree($tree->sha1)],
path => $c->stash->{filename}, # FIXME?
);
};

Expand Down
2 changes: 1 addition & 1 deletion lib/Gitalist/Git/Object/Commit.pm
Expand Up @@ -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
}
Expand Down
14 changes: 10 additions & 4 deletions root/_diff.tt2
Expand Up @@ -7,13 +7,19 @@
[% FOREACH item IN diff %]

<h4 id="diff[% loop.count %]" class='diff-head'>diff --git [%# FIXME %]
<a href='[% c.uri_for_action("/ref/blob", [Repository.name, Commit.sha1], item.file) %]' title="Blob">[% item.a %]</a>
<a href='[% c.uri_for_action("/ref/blob", [Repository.name, Commit.sha1], item.file) %]' title="Blob">[% item.b %]</a>
[% IF !item.src.match('^0+$') %]
<a href='[% c.uri_for_action("/ref/blob", [Repository.name, item.src]) %]' title="Blob">[% item.a %]</a>
[% ELSE %]
[% item.a %]
[% END %]
[% IF !item.dst.match('^0+$') %]
<a href='[% c.uri_for_action("/ref/blob", [Repository.name, item.dst]) %]' title="Blob">[% item.b %]</a>
[% ELSE %]
[% item.b %]
[% END %]
</h4>




<div class='diff-patch'>
<pre>[% blobs.${loop.index} %]</pre>
</div>
Expand Down
2 changes: 1 addition & 1 deletion root/fragment/ref/commit.tt2
Expand Up @@ -38,7 +38,7 @@
<tr>
<td class='sha1'>[% INCLUDE 'inc/chroma_hash.tt2' sha1 = Commit.sha1.substr(0, 7), hide_sha1_output = 1 %] <div class="sha1_label">Commit</div></td>
<td>[% Commit.sha1 %]</td>
<td class='action-list'></td>
<td class='action-list'><a href="[% c.uri_for_action('/ref/diff_fancy', [Repository.name, Commit.sha1]) %]" title="Difference" class="button diff">diff</a></td>
</tr>
<tr>
<td class='sha1'>[% INCLUDE 'inc/chroma_hash.tt2' sha1 = Commit.tree_sha1.substr(0, 7), hide_sha1_output = 1 %] <div class="sha1_label">Tree</div></td>
Expand Down
9 changes: 1 addition & 8 deletions 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) %]

0 comments on commit 3a58f00

Please sign in to comment.