summaryrefslogtreecommitdiffabout
path: root/ui-diff.c
Side-by-side diff
Diffstat (limited to 'ui-diff.c') (more/less context) (ignore whitespace changes)
-rw-r--r--ui-diff.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/ui-diff.c b/ui-diff.c
index 999b6f3..afe1c90 100644
--- a/ui-diff.c
+++ b/ui-diff.c
@@ -68,3 +68,3 @@ static void filepair_cb(struct diff_filepair *pair)
-void cgit_print_diff(const char *old_hex, const char *new_hex, char *path)
+void cgit_print_diff(const char *head, const char *old_hex, const char *new_hex, char *path)
{
@@ -73,2 +73,14 @@ void cgit_print_diff(const char *old_hex, const char *new_hex, char *path)
unsigned long size;
+ struct commit *commit;
+
+ if (head && !old_hex && !new_hex) {
+ get_sha1(head, sha1);
+ commit = lookup_commit_reference(sha1);
+ if (commit && !parse_commit(commit)) {
+ html("<table class='diff'>");
+ cgit_diff_commit(commit, filepair_cb);
+ html("</td></tr></table>");
+ }
+ return;
+ }