branch: error code with --edit-description

Since c2d17ba3db0d (branch --edit-description: protect against mistyped branch name, 2012-02-05) we return -1 on error editing the branch description. Let's change to 1, which follows the established convention and it is better for portability reasons. Signed-off-by: Rubén Justo <rjusto@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Rubén Justo committed Oct 26, 2022 at 00:57 UTC 8f241151656053e3ae130e9e0025b9cf71ccc3ce
2 files changed +2 -2
builtin/branch.c
+1 -1
@@ -816,7 +816,7 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
816
817 strbuf_addf(&branch_ref, "refs/heads/%s", branch_name);
818 if (!ref_exists(branch_ref.buf))
819 - ret = error((!argc || !strcmp(head, branch_name))
819 + error((!argc || !strcmp(head, branch_name))
820 ? _("No commit on branch '%s' yet.")
821 : _("No branch named '%s'."),
822 branch_name);
t/t3200-branch.sh
+1 -1
@@ -1383,7 +1383,7 @@ test_expect_success 'branch --delete --force removes dangling branch' '
1383
1384 test_expect_success 'use --edit-description' '
1385 EDITOR=: git branch --edit-description &&
1386 - test_must_fail git config branch.main.description &&
1386 + test_expect_code 1 git config branch.main.description &&
1387
1388 write_script editor <<-\EOF &&
1389 echo "New contents" >"$1"