]> git.ipfire.org Git - thirdparty/git.git/commitdiff
branch: error code with --edit-description
authorRubén Justo <rjusto@gmail.com>
Tue, 25 Oct 2022 22:57:18 +0000 (00:57 +0200)
committerJunio C Hamano <gitster@pobox.com>
Wed, 26 Oct 2022 17:52:37 +0000 (10:52 -0700)
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>
builtin/branch.c
t/t3200-branch.sh

index 407517ba68447322b0e9a4ccaff2df5fc83186e9..4df001f5798f3f8f122e83420ea2745abb56454a 100644 (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);
index 7d8edff9c320f04aed15932cde1ad16dbec30f22..a390394b4c8342d1e10bc6a327bd938357f79386 100755 (executable)
@@ -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"