author | Lars Hjemli <hjemli@gmail.com> | 2007-10-01 09:42:19 (UTC) |
---|---|---|
committer | Lars Hjemli <hjemli@gmail.com> | 2007-10-01 09:42:19 (UTC) |
commit | f527a57c8a55f5fd315e1bc1cb338f5f4a9b20ae (patch) (unidiff) | |
tree | 086e1afad5762c5b6bb09672b58f2c491ffbbc20 /ui-diff.c | |
parent | 98fcf7227c8dda520c864ea8a51012934115258f (diff) | |
download | cgit-f527a57c8a55f5fd315e1bc1cb338f5f4a9b20ae.zip cgit-f527a57c8a55f5fd315e1bc1cb338f5f4a9b20ae.tar.gz cgit-f527a57c8a55f5fd315e1bc1cb338f5f4a9b20ae.tar.bz2 |
Add prefix parameter to cgit_diff_tree()
This paramter can be used to restrict a diff to the specified path prefix.
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
-rw-r--r-- | ui-diff.c | 3 |
1 files changed, 1 insertions, 2 deletions
@@ -102,39 +102,38 @@ void cgit_print_diff(const char *new_rev, const char *old_rev) | |||
102 | type = sha1_object_info(sha1, &size); | 102 | type = sha1_object_info(sha1, &size); |
103 | if (type == OBJ_BAD) { | 103 | if (type == OBJ_BAD) { |
104 | cgit_print_error(fmt("Bad object name: %s", new_rev)); | 104 | cgit_print_error(fmt("Bad object name: %s", new_rev)); |
105 | return; | 105 | return; |
106 | } | 106 | } |
107 | if (type != OBJ_COMMIT) { | 107 | if (type != OBJ_COMMIT) { |
108 | cgit_print_error(fmt("Unhandled object type: %s", | 108 | cgit_print_error(fmt("Unhandled object type: %s", |
109 | typename(type))); | 109 | typename(type))); |
110 | return; | 110 | return; |
111 | } | 111 | } |
112 | 112 | ||
113 | commit = lookup_commit_reference(sha1); | 113 | commit = lookup_commit_reference(sha1); |
114 | if (!commit || parse_commit(commit)) | 114 | if (!commit || parse_commit(commit)) |
115 | cgit_print_error(fmt("Bad commit: %s", sha1_to_hex(sha1))); | 115 | cgit_print_error(fmt("Bad commit: %s", sha1_to_hex(sha1))); |
116 | 116 | ||
117 | if (old_rev) | 117 | if (old_rev) |
118 | get_sha1(old_rev, sha2); | 118 | get_sha1(old_rev, sha2); |
119 | else if (commit->parents && commit->parents->item) | 119 | else if (commit->parents && commit->parents->item) |
120 | hashcpy(sha2, commit->parents->item->object.sha1); | 120 | hashcpy(sha2, commit->parents->item->object.sha1); |
121 | else | 121 | else |
122 | hashclr(sha2); | 122 | hashclr(sha2); |
123 | 123 | ||
124 | if (!is_null_sha1(sha2)) { | 124 | if (!is_null_sha1(sha2)) { |
125 | type = sha1_object_info(sha2, &size); | 125 | type = sha1_object_info(sha2, &size); |
126 | if (type == OBJ_BAD) { | 126 | if (type == OBJ_BAD) { |
127 | cgit_print_error(fmt("Bad object name: %s", sha1_to_hex(sha2))); | 127 | cgit_print_error(fmt("Bad object name: %s", sha1_to_hex(sha2))); |
128 | return; | 128 | return; |
129 | } | 129 | } |
130 | commit2 = lookup_commit_reference(sha2); | 130 | commit2 = lookup_commit_reference(sha2); |
131 | if (!commit2 || parse_commit(commit2)) | 131 | if (!commit2 || parse_commit(commit2)) |
132 | cgit_print_error(fmt("Bad commit: %s", sha1_to_hex(sha2))); | 132 | cgit_print_error(fmt("Bad commit: %s", sha1_to_hex(sha2))); |
133 | } | 133 | } |
134 | |||
135 | html("<table class='diff'>"); | 134 | html("<table class='diff'>"); |
136 | html("<tr><td>"); | 135 | html("<tr><td>"); |
137 | cgit_diff_tree(sha2, sha1, filepair_cb); | 136 | cgit_diff_tree(sha2, sha1, filepair_cb, NULL); |
138 | html("</td></tr>"); | 137 | html("</td></tr>"); |
139 | html("</table>"); | 138 | html("</table>"); |
140 | } | 139 | } |