diff options
author | David Turner <novalis@novalis.org> | 2019-01-17 23:19:43 -0500 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2019-01-18 15:22:02 -0800 |
commit | d1dd94b308607d0a37aa8a013fd20678956d3531 (patch) | |
tree | 76941b07caff798b7e8b45c05d7c88075b087f63 /builtin/cat-file.c | |
parent | Third batch after 2.20 (diff) | |
download | tgif-d1dd94b308607d0a37aa8a013fd20678956d3531.tar.xz |
Do not print 'dangling' for cat-file in case of ambiguity
The return values -1 and -2 from get_oid could mean two different
things, depending on whether they were from an enum returned by
get_tree_entry_follow_symlinks, or from a different code path. This
caused 'dangling' to be printed from a git cat-file in the case of an
ambiguous (-2) result.
Unify the results of get_oid* and get_tree_entry_follow_symlinks to be
one common type, with unambiguous values.
Signed-off-by: David Turner <novalis@novalis.org>
Reported-by: Eric Wong <e@80x24.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/cat-file.c')
-rw-r--r-- | builtin/cat-file.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/builtin/cat-file.c b/builtin/cat-file.c index 2ca56fd086..cebc6d7f8a 100644 --- a/builtin/cat-file.c +++ b/builtin/cat-file.c @@ -380,7 +380,7 @@ static void batch_one_object(const char *obj_name, { struct object_context ctx; int flags = opt->follow_symlinks ? GET_OID_FOLLOW_SYMLINKS : 0; - enum follow_symlinks_result result; + enum get_oid_result result; result = get_oid_with_context(obj_name, flags, &data->oid, &ctx); if (result != FOUND) { @@ -388,6 +388,9 @@ static void batch_one_object(const char *obj_name, case MISSING_OBJECT: printf("%s missing\n", obj_name); break; + case SHORT_NAME_AMBIGUOUS: + printf("%s ambiguous\n", obj_name); + break; case DANGLING_SYMLINK: printf("dangling %"PRIuMAX"\n%s\n", (uintmax_t)strlen(obj_name), obj_name); |