branch: error code with --edit-description

Since c2d17ba3db (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>
This commit is contained in:
Rubén Justo 2022-10-26 00:57:18 +02:00 committed by Junio C Hamano
parent db29e6bbae
commit 8f24115165
2 changed files with 2 additions and 2 deletions

View File

@ -816,7 +816,7 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
strbuf_addf(&branch_ref, "refs/heads/%s", branch_name);
if (!ref_exists(branch_ref.buf))
ret = error((!argc || !strcmp(head, branch_name))
error((!argc || !strcmp(head, branch_name))
? _("No commit on branch '%s' yet.")
: _("No branch named '%s'."),
branch_name);

View File

@ -1383,7 +1383,7 @@ test_expect_success 'branch --delete --force removes dangling branch' '
test_expect_success 'use --edit-description' '
EDITOR=: git branch --edit-description &&
test_must_fail git config branch.main.description &&
test_expect_code 1 git config branch.main.description &&
write_script editor <<-\EOF &&
echo "New contents" >"$1"