Skip to content

Commit 8f24115

Browse files
rjustogitster
authored andcommitted
branch: error code with --edit-description
Since c2d17ba (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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent db29e6b commit 8f24115

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

builtin/branch.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -816,7 +816,7 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
816816

817817
strbuf_addf(&branch_ref, "refs/heads/%s", branch_name);
818818
if (!ref_exists(branch_ref.buf))
819-
ret = error((!argc || !strcmp(head, branch_name))
819+
error((!argc || !strcmp(head, branch_name))
820820
? _("No commit on branch '%s' yet.")
821821
: _("No branch named '%s'."),
822822
branch_name);

t/t3200-branch.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1383,7 +1383,7 @@ test_expect_success 'branch --delete --force removes dangling branch' '
13831383

13841384
test_expect_success 'use --edit-description' '
13851385
EDITOR=: git branch --edit-description &&
1386-
test_must_fail git config branch.main.description &&
1386+
test_expect_code 1 git config branch.main.description &&
13871387
13881388
write_script editor <<-\EOF &&
13891389
echo "New contents" >"$1"

0 commit comments

Comments
 (0)