Merge branch 'rj/branch-do-not-exit-with-minus-one-status'

"git branch --edit-description" can exit with status -1 which is
not a good practice; it learned to use 1 as everybody else instead.

* rj/branch-do-not-exit-with-minus-one-status:
  branch: error code with --edit-description
This commit is contained in:
Taylor Blau 2022-10-30 21:04:43 -04:00
commit bf0d9d0d34
2 changed files with 2 additions and 2 deletions

View File

@ -809,7 +809,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

@ -1394,7 +1394,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"