diff options
author | Junio C Hamano <gitster@pobox.com> | 2012-06-20 22:07:36 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2012-07-03 10:24:15 -0700 |
commit | a78fafe74a4f8c416c35ca07b3ba28375475ae96 (patch) | |
tree | cab44a37f603cd8c67f7a8a0a0b14d2595f6d996 /t/t7105-reset-patch.sh | |
parent | sha1_name.c: correct misnamed "canonical" and "res" (diff) | |
download | tgif-a78fafe74a4f8c416c35ca07b3ba28375475ae96.tar.xz |
sha1_name.c: restructure disambiguation of short names
We try to find zero, one or more matches from loose objects and
packed objects independently and then decide if the given short
object name is unique across them.
Instead, introduce a "struct disambiguate_state" that keeps track of
what we have found so far, that can be one of:
- We have seen one object that _could_ be what we are looking for;
- We have also checked that object for additional constraints (if any),
and found that the object satisfies it;
- We have also checked that object for additional constraints (if any),
and found that the object does not satisfy it; or
- We have seen more than one objects that satisfy the constraints.
and pass it to the enumeration functions for loose and packed
objects. The disambiguation state can optionally take a callback
function that takes a candidate object name and reports if the
object satisifies additional criteria (e.g. when the caller knows
that the short name must refer to a commit, this mechanism can be
used to check the type of the given object).
Compared to the earlier attempt, this round avoids the optional
check if there is only one candidate that matches the short name in
the first place.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t7105-reset-patch.sh')
0 files changed, 0 insertions, 0 deletions