Skip to content

Commit ac59c74

Browse files
chooglengitster
authored andcommitted
branch --set-upstream-to: be consistent when advising
"git branch --set-upstream-to" behaves differently when advice is enabled/disabled: | | error prefix | exit code | |-----------------+--------------+-----------| | advice enabled | error: | 1 | | advice disabled | fatal: | 128 | Make both cases consistent by using die_message() when advice is enabled (this was first proposed in [1]). [1] https://lore.kernel.org/git/[email protected] Signed-off-by: Glen Choo <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent cfbda6b commit ac59c74

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

branch.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -384,9 +384,10 @@ static void dwim_branch_start(struct repository *r, const char *start_name,
384384
if (get_oid_mb(start_name, &oid)) {
385385
if (explicit_tracking) {
386386
if (advice_enabled(ADVICE_SET_UPSTREAM_FAILURE)) {
387-
error(_(upstream_missing), start_name);
387+
int code = die_message(_(upstream_missing),
388+
start_name);
388389
advise(_(upstream_advice));
389-
exit(1);
390+
exit(code);
390391
}
391392
die(_(upstream_missing), start_name);
392393
}

0 commit comments

Comments
 (0)