From 4adceb5a299164aad1ef9794cdcbdb232ab10299 Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Sun, 1 Oct 2023 15:18:45 +0000 Subject: diff: fix --merge-base with annotated tags Checking early for OBJ_COMMIT excludes other objects that can be resolved to commits, like annotated tags. If we remove it, annotated tags will be resolved and handled just fine by lookup_commit_reference(), and if we are given something that can't be resolved to a commit, we'll still get a useful error message, e.g.: > error: object 21ab162211ac3ef13c37603ca88b27e9c7e0d40b is a tree, not a commit > fatal: no merge base found Signed-off-by: Alyssa Ross Signed-off-by: Junio C Hamano --- diff-lib.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'diff-lib.c') diff --git a/diff-lib.c b/diff-lib.c index 6b0c6a7180..543398b4d8 100644 --- a/diff-lib.c +++ b/diff-lib.c @@ -572,8 +572,6 @@ void diff_get_merge_base(const struct rev_info *revs, struct object_id *mb) struct object *obj = revs->pending.objects[i].item; if (obj->flags) die(_("--merge-base does not work with ranges")); - if (obj->type != OBJ_COMMIT) - die(_("--merge-base only works with commits")); } /* -- cgit v1.2.3