Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelipe Contreras <felipe.contreras@gmail.com>2023-03-16 20:15:14 +0300
committerJunio C Hamano <gitster@pobox.com>2023-03-16 20:44:56 +0300
commitdfbfdc521daece092a599959da79c3c134f26b3c (patch)
tree002ca0e16de54c4a252214a8bb221cee180f3c90 /object-name.c
parent7556e5d737b917d31ac3729b0f5e2391da7e132a (diff)
object-name: fix quiet @{u} parsing
Currently `git rev-parse --quiet @{u}` is not actually quiet when upstream isn't configured: fatal: no upstream configured for branch 'foo' Make it so. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'object-name.c')
-rw-r--r--object-name.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/object-name.c b/object-name.c
index 2dd1a0f56e..d9f3a176d8 100644
--- a/object-name.c
+++ b/object-name.c
@@ -898,6 +898,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) {
@@ -952,11 +953,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;