Skip to content

Commit a819e2b

Browse files
committed
Merge branch 'ow/push-quiet-set-upstream'
"git push --quiet --set-upstream" was not quiet when setting the upstream branch configuration, which has been corrected. * ow/push-quiet-set-upstream: transport: respect verbosity when setting upstream
2 parents 279a2e6 + f3cce89 commit a819e2b

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

t/t5523-push-upstream.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,4 +119,11 @@ test_expect_success TTY 'quiet push' '
119119
test_must_be_empty output
120120
'
121121

122+
test_expect_success TTY 'quiet push -u' '
123+
ensure_fresh_upstream &&
124+
125+
test_terminal git push --quiet -u --no-progress upstream main 2>&1 | tee output &&
126+
test_must_be_empty output
127+
'
128+
122129
test_done

transport.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -108,11 +108,11 @@ static void set_upstreams(struct transport *transport, struct ref *refs,
108108
if (!remotename || !starts_with(remotename, "refs/heads/"))
109109
continue;
110110

111-
if (!pretend)
112-
install_branch_config(BRANCH_CONFIG_VERBOSE,
113-
localname + 11, transport->remote->name,
114-
remotename);
115-
else
111+
if (!pretend) {
112+
int flag = transport->verbose < 0 ? 0 : BRANCH_CONFIG_VERBOSE;
113+
install_branch_config(flag, localname + 11,
114+
transport->remote->name, remotename);
115+
} else if (transport->verbose >= 0)
116116
printf(_("Would set upstream of '%s' to '%s' of '%s'\n"),
117117
localname + 11, remotename + 11,
118118
transport->remote->name);

0 commit comments

Comments
 (0)