author | Lars Hjemli <hjemli@gmail.com> | 2007-05-15 22:58:35 (UTC) |
---|---|---|
committer | Lars Hjemli <hjemli@gmail.com> | 2007-05-15 22:58:35 (UTC) |
commit | f9ff7df613b4ee86fe5914c4ae3400650882c03d (patch) (side-by-side diff) | |
tree | c26fde3a4d3485943c275232f18359bebd133f1a /ui-diff.c | |
parent | a2ddc10479ec463708e422ca5ce7ec02c22a7d02 (diff) | |
download | cgit-f9ff7df613b4ee86fe5914c4ae3400650882c03d.zip cgit-f9ff7df613b4ee86fe5914c4ae3400650882c03d.tar.gz cgit-f9ff7df613b4ee86fe5914c4ae3400650882c03d.tar.bz2 |
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>
-rw-r--r-- | ui-diff.c | 14 |
1 files changed, 13 insertions, 1 deletions
@@ -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; + } |