transport: respect verbosity when setting upstream
A command such as `git push -qu origin feature` will print "Branch 'feature' set up to track remote branch 'feature' from 'origin'." even when --quiet is passed. In this case it's because install_branch_config() is always called with BRANCH_CONFIG_VERBOSE. struct transport keeps track of the desired verbosity. Fix the above issue by passing BRANCH_CONFIG_VERBOSE conditionally based on that. Signed-off-by: Øystein Walle <oystwa@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
48bf2fa8ba
commit
f3cce896a8
@ -119,4 +119,11 @@ test_expect_success TTY 'quiet push' '
|
|||||||
test_must_be_empty output
|
test_must_be_empty output
|
||||||
'
|
'
|
||||||
|
|
||||||
|
test_expect_success TTY 'quiet push -u' '
|
||||||
|
ensure_fresh_upstream &&
|
||||||
|
|
||||||
|
test_terminal git push --quiet -u --no-progress upstream main 2>&1 | tee output &&
|
||||||
|
test_must_be_empty output
|
||||||
|
'
|
||||||
|
|
||||||
test_done
|
test_done
|
||||||
|
10
transport.c
10
transport.c
@ -108,11 +108,11 @@ static void set_upstreams(struct transport *transport, struct ref *refs,
|
|||||||
if (!remotename || !starts_with(remotename, "refs/heads/"))
|
if (!remotename || !starts_with(remotename, "refs/heads/"))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!pretend)
|
if (!pretend) {
|
||||||
install_branch_config(BRANCH_CONFIG_VERBOSE,
|
int flag = transport->verbose < 0 ? 0 : BRANCH_CONFIG_VERBOSE;
|
||||||
localname + 11, transport->remote->name,
|
install_branch_config(flag, localname + 11,
|
||||||
remotename);
|
transport->remote->name, remotename);
|
||||||
else
|
} else if (transport->verbose >= 0)
|
||||||
printf(_("Would set upstream of '%s' to '%s' of '%s'\n"),
|
printf(_("Would set upstream of '%s' to '%s' of '%s'\n"),
|
||||||
localname + 11, remotename + 11,
|
localname + 11, remotename + 11,
|
||||||
transport->remote->name);
|
transport->remote->name);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user