summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rwxr-xr-xtests/t0105-commit.sh2
-rw-r--r--ui-diff.c1
2 files changed, 2 insertions, 1 deletions
diff --git a/tests/t0105-commit.sh b/tests/t0105-commit.sh
index 4e1236b..a864612 100755
--- a/tests/t0105-commit.sh
+++ b/tests/t0105-commit.sh
@@ -17,21 +17,21 @@ run_test 'find diffstat' 'grep -e "<table summary=.diffstat. class=.diffstat.>"
run_test 'find diff summary' '
grep -e "1 files changed, 1 insertions, 0 deletions" trash/tmp
'
run_test 'get root commit' '
root=$(cd trash/repos/foo && git rev-list --reverse HEAD | head -1) &&
cgit_url "foo/commit&id=$root" >trash/tmp &&
grep "</html>" trash/tmp
'
run_test 'root commit contains diffstat' '
- grep "<a href=./foo/diff/file-1.>file-1</a>" trash/tmp
+ grep "<a href=./foo/diff/file-1.id=[0-9a-f]\{40\}.>file-1</a>" trash/tmp
'
run_test 'root commit contains diff' '
grep ">diff --git a/file-1 b/file-1<" trash/tmp &&
grep -e "<div class=.add.>+1</div>" trash/tmp
'
tests_done
diff --git a/ui-diff.c b/ui-diff.c
index 12e78b1..1c182aa 100644
--- a/ui-diff.c
+++ b/ui-diff.c
@@ -136,24 +136,25 @@ static void inspect_filepair(struct diff_filepair *pair)
total_adds += lines_added;
total_rems += lines_removed;
}
void cgit_print_diffstat(const unsigned char *old_sha1,
const unsigned char *new_sha1)
{
int i;
html("<div class='diffstat-header'>Diffstat</div>");
html("<table summary='diffstat' class='diffstat'>");
max_changes = 0;
+ curr_rev = xstrdup(sha1_to_hex(new_sha1));
cgit_diff_tree(old_sha1, new_sha1, inspect_filepair, NULL);
for(i = 0; i<files; i++)
print_fileinfo(&items[i]);
html("</table>");
html("<div class='diffstat-summary'>");
htmlf("%d files changed, %d insertions, %d deletions",
files, total_adds, total_rems);
html("</div>");
}
/*