зеркало из https://github.com/microsoft/git.git
handle_revision_arg: simplify commit reference lookups
The "dotdot" range parser avoids calling lookup_commit_reference() if we are directly fed two commits. But its casts are unnecessarily complex; that function will just return a commit we pass into it. Just calling the function all the time is much simpler, and doesn't do any significant extra work (the object is already parsed, and deref_tag() on a non-tag is a noop; we do incur one extra lookup_object() call, but that's fairly trivial). Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Родитель
ed79b2cf03
Коммит
1d6c93817b
|
@ -1500,12 +1500,8 @@ int handle_revision_arg(const char *arg_, struct rev_info *revs, int flags, unsi
|
|||
struct commit *a, *b;
|
||||
struct commit_list *exclude;
|
||||
|
||||
a = (a_obj->type == OBJ_COMMIT
|
||||
? (struct commit *)a_obj
|
||||
: lookup_commit_reference(a_obj->oid.hash));
|
||||
b = (b_obj->type == OBJ_COMMIT
|
||||
? (struct commit *)b_obj
|
||||
: lookup_commit_reference(b_obj->oid.hash));
|
||||
a = lookup_commit_reference(a_obj->oid.hash);
|
||||
b = lookup_commit_reference(b_obj->oid.hash);
|
||||
if (!a || !b)
|
||||
goto missing;
|
||||
exclude = get_merge_bases(a, b);
|
||||
|
|
Загрузка…
Ссылка в новой задаче