diff options
author | Junio C Hamano <gitster@pobox.com> | 2023-03-28 20:51:52 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2023-03-28 20:51:52 +0300 |
commit | 8069aa01cd83d187813117b34ed718245d56eac9 (patch) | |
tree | 1f58950ea6735b440b80acd2b4e6e639875ea0ff /object-name.c | |
parent | 6041a13ec2958b5c39a5f2bbadfffb4d4ce79d46 (diff) | |
parent | dfbfdc521daece092a599959da79c3c134f26b3c (diff) |
Merge branch 'fc/oid-quietly-parse-upstream'
"git rev-parse --quiet foo@{u}", or anything that asks @{u} to be
parsed with GET_OID_QUIETLY option, did not quietly fail, which has
been corrected.
* fc/oid-quietly-parse-upstream:
object-name: fix quiet @{u} parsing
Diffstat (limited to 'object-name.c')
-rw-r--r-- | object-name.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/object-name.c b/object-name.c index 69db1ec498..61e8540f2e 100644 --- a/object-name.c +++ b/object-name.c @@ -899,6 +899,7 @@ static int get_oid_basic(struct repository *r, const char *str, int len, char *real_ref = NULL; int refs_found = 0; int at, reflog_len, nth_prior = 0; + int fatal = !(flags & GET_OID_QUIETLY); if (len == r->hash_algo->hexsz && !get_oid_hex(str, oid)) { if (warn_ambiguous_refs && warn_on_object_refname_ambiguity) { @@ -953,11 +954,11 @@ static int get_oid_basic(struct repository *r, const char *str, int len, if (!len && reflog_len) /* allow "@{...}" to mean the current branch reflog */ - refs_found = repo_dwim_ref(r, "HEAD", 4, oid, &real_ref, 0); + refs_found = repo_dwim_ref(r, "HEAD", 4, oid, &real_ref, !fatal); else if (reflog_len) refs_found = repo_dwim_log(r, str, len, oid, &real_ref); else - refs_found = repo_dwim_ref(r, str, len, oid, &real_ref, 0); + refs_found = repo_dwim_ref(r, str, len, oid, &real_ref, !fatal); if (!refs_found) return -1; |