diff options
author | Lars Hjemli | 2007-05-16 00:58:35 +0200 |
---|---|---|
committer | Lars Hjemli | 2007-05-16 00:58:35 +0200 |
commit | f9ff7df613b4ee86fe5914c4ae3400650882c03d (patch) | |
tree | c26fde3a4d3485943c275232f18359bebd133f1a /ui-diff.c | |
parent | a2ddc10479ec463708e422ca5ce7ec02c22a7d02 (diff) | |
download | cgit-f9ff7df613b4ee86fe5914c4ae3400650882c03d.tar.gz cgit-f9ff7df613b4ee86fe5914c4ae3400650882c03d.tar.bz2 cgit-f9ff7df613b4ee86fe5914c4ae3400650882c03d.zip |
Add support for commitdiff via h parameter
The commitdiff will be generated against the first parent, and the
diff page also gets the benefit of repo.defbranch.
Cleaned up some bad whitespace in cgit.h while at it.
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Diffstat (limited to 'ui-diff.c')
-rw-r--r-- | ui-diff.c | 14 |
1 files changed, 13 insertions, 1 deletions
@@ -66,11 +66,23 @@ static void filepair_cb(struct diff_filepair *pair) | |||
66 | html("</tr></td>"); | 66 | html("</tr></td>"); |
67 | } | 67 | } |
68 | 68 | ||
69 | void cgit_print_diff(const char *old_hex, const char *new_hex, char *path) | 69 | void cgit_print_diff(const char *head, const char *old_hex, const char *new_hex, char *path) |
70 | { | 70 | { |
71 | unsigned char sha1[20], sha2[20]; | 71 | unsigned char sha1[20], sha2[20]; |
72 | enum object_type type; | 72 | enum object_type type; |
73 | unsigned long size; | 73 | unsigned long size; |
74 | struct commit *commit; | ||
75 | |||
76 | if (head && !old_hex && !new_hex) { | ||
77 | get_sha1(head, sha1); | ||
78 | commit = lookup_commit_reference(sha1); | ||
79 | if (commit && !parse_commit(commit)) { | ||
80 | html("<table class='diff'>"); | ||
81 | cgit_diff_commit(commit, filepair_cb); | ||
82 | html("</td></tr></table>"); | ||
83 | } | ||
84 | return; | ||
85 | } | ||
74 | 86 | ||
75 | get_sha1(old_hex, sha1); | 87 | get_sha1(old_hex, sha1); |
76 | get_sha1(new_hex, sha2); | 88 | get_sha1(new_hex, sha2); |