author | Lars Hjemli <hjemli@gmail.com> | 2008-04-24 21:40:51 (UTC) |
---|---|---|
committer | Lars Hjemli <hjemli@gmail.com> | 2008-04-24 21:41:39 (UTC) |
commit | d188ed4f2905e6d10abd26c45572a0d48eb53969 (patch) (unidiff) | |
tree | 4ae96ddebd908091ca88a339e58040cf38049bb1 | |
parent | fe1230dece81450004d02fa8a470f8dab8f7fdd9 (diff) | |
download | cgit-d188ed4f2905e6d10abd26c45572a0d48eb53969.zip cgit-d188ed4f2905e6d10abd26c45572a0d48eb53969.tar.gz cgit-d188ed4f2905e6d10abd26c45572a0d48eb53969.tar.bz2 |
ui-diff: remove test on object type
By removing the test for commit objects it's now possible to specify a
tag name for the id query-string parameter (it already worked for id2).
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
-rw-r--r-- | ui-diff.c | 6 |
1 files changed, 0 insertions, 6 deletions
@@ -245,38 +245,32 @@ static void filepair_cb(struct diff_filepair *pair) | |||
245 | } | 245 | } |
246 | 246 | ||
247 | void cgit_print_diff(const char *new_rev, const char *old_rev, const char *prefix) | 247 | void cgit_print_diff(const char *new_rev, const char *old_rev, const char *prefix) |
248 | { | 248 | { |
249 | enum object_type type; | 249 | enum object_type type; |
250 | unsigned long size; | 250 | unsigned long size; |
251 | struct commit *commit, *commit2; | 251 | struct commit *commit, *commit2; |
252 | 252 | ||
253 | if (!new_rev) | 253 | if (!new_rev) |
254 | new_rev = ctx.qry.head; | 254 | new_rev = ctx.qry.head; |
255 | get_sha1(new_rev, new_rev_sha1); | 255 | get_sha1(new_rev, new_rev_sha1); |
256 | type = sha1_object_info(new_rev_sha1, &size); | 256 | type = sha1_object_info(new_rev_sha1, &size); |
257 | if (type == OBJ_BAD) { | 257 | if (type == OBJ_BAD) { |
258 | cgit_print_error(fmt("Bad object name: %s", new_rev)); | 258 | cgit_print_error(fmt("Bad object name: %s", new_rev)); |
259 | return; | 259 | return; |
260 | } | 260 | } |
261 | if (type != OBJ_COMMIT) { | ||
262 | cgit_print_error(fmt("Unhandled object type: %s", | ||
263 | typename(type))); | ||
264 | return; | ||
265 | } | ||
266 | |||
267 | commit = lookup_commit_reference(new_rev_sha1); | 261 | commit = lookup_commit_reference(new_rev_sha1); |
268 | if (!commit || parse_commit(commit)) | 262 | if (!commit || parse_commit(commit)) |
269 | cgit_print_error(fmt("Bad commit: %s", sha1_to_hex(new_rev_sha1))); | 263 | cgit_print_error(fmt("Bad commit: %s", sha1_to_hex(new_rev_sha1))); |
270 | 264 | ||
271 | if (old_rev) | 265 | if (old_rev) |
272 | get_sha1(old_rev, old_rev_sha1); | 266 | get_sha1(old_rev, old_rev_sha1); |
273 | else if (commit->parents && commit->parents->item) | 267 | else if (commit->parents && commit->parents->item) |
274 | hashcpy(old_rev_sha1, commit->parents->item->object.sha1); | 268 | hashcpy(old_rev_sha1, commit->parents->item->object.sha1); |
275 | else | 269 | else |
276 | hashclr(old_rev_sha1); | 270 | hashclr(old_rev_sha1); |
277 | 271 | ||
278 | if (!is_null_sha1(old_rev_sha1)) { | 272 | if (!is_null_sha1(old_rev_sha1)) { |
279 | type = sha1_object_info(old_rev_sha1, &size); | 273 | type = sha1_object_info(old_rev_sha1, &size); |
280 | if (type == OBJ_BAD) { | 274 | if (type == OBJ_BAD) { |
281 | cgit_print_error(fmt("Bad object name: %s", sha1_to_hex(old_rev_sha1))); | 275 | cgit_print_error(fmt("Bad object name: %s", sha1_to_hex(old_rev_sha1))); |
282 | return; | 276 | return; |