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:
authorGlen Choo <chooglen@google.com>2022-03-29 23:01:18 +0300
committerJunio C Hamano <gitster@pobox.com>2022-03-31 00:15:54 +0300
commitac59c742de5f548ed07735fb212cc87129383bcd (patch)
tree9f6f659402251ec99493b72d06b0ca556a28a819 /branch.c
parentcfbda6ba6b33e903df58f96fdb2ee9314097ff2f (diff)
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/211210.86ee6ldwlc.gmgdl@evledraar.gmail.com Signed-off-by: Glen Choo <chooglen@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'branch.c')
-rw-r--r--branch.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/branch.c b/branch.c
index 50459c432c..add6a37b79 100644
--- a/branch.c
+++ b/branch.c
@@ -384,9 +384,10 @@ static void dwim_branch_start(struct repository *r, const char *start_name,
if (get_oid_mb(start_name, &oid)) {
if (explicit_tracking) {
if (advice_enabled(ADVICE_SET_UPSTREAM_FAILURE)) {
- error(_(upstream_missing), start_name);
+ int code = die_message(_(upstream_missing),
+ start_name);
advise(_(upstream_advice));
- exit(1);
+ exit(code);
}
die(_(upstream_missing), start_name);
}