Merge branch 'jc/branch-in-use-error-message' into next
"git branch -f X" to repoint the branch X seid that X was "checked out" in another worktree, even when branch X was not and instead being bisected or rebased. The message was reworded to say the branch was "in use". * jc/branch-in-use-error-message: branch: update the message to refuse touching a branch in-use
This commit is contained in:
2
branch.c
2
branch.c
@ -471,7 +471,7 @@ int validate_new_branchname(const char *name, struct strbuf *ref, int force)
|
||||
|
||||
if ((path = branch_checked_out(ref->buf)))
|
||||
die(_("cannot force update the branch '%s' "
|
||||
"checked out at '%s'"),
|
||||
"used by worktree at '%s'"),
|
||||
ref->buf + strlen("refs/heads/"), path);
|
||||
|
||||
return 1;
|
||||
|
@ -58,7 +58,7 @@ test_expect_success !SANITIZE_LEAK 'refuse to overwrite: worktree in bisect' '
|
||||
git -C wt-4 bisect good wt-1 &&
|
||||
|
||||
test_must_fail git branch -f wt-4 HEAD 2>err &&
|
||||
grep "cannot force update the branch '\''wt-4'\'' checked out at.*wt-4" err
|
||||
grep "cannot force update the branch '\''wt-4'\'' used by worktree at.*wt-4" err
|
||||
'
|
||||
|
||||
test_expect_success !SANITIZE_LEAK 'refuse to overwrite: worktree in rebase (apply)' '
|
||||
@ -68,7 +68,7 @@ test_expect_success !SANITIZE_LEAK 'refuse to overwrite: worktree in rebase (app
|
||||
test_must_fail git -C wt-2 rebase --apply conflict-2 &&
|
||||
|
||||
test_must_fail git branch -f wt-2 HEAD 2>err &&
|
||||
grep "cannot force update the branch '\''wt-2'\'' checked out at.*wt-2" err
|
||||
grep "cannot force update the branch '\''wt-2'\'' used by worktree at.*wt-2" err
|
||||
'
|
||||
|
||||
test_expect_success !SANITIZE_LEAK 'refuse to overwrite: worktree in rebase (merge)' '
|
||||
@ -78,7 +78,7 @@ test_expect_success !SANITIZE_LEAK 'refuse to overwrite: worktree in rebase (mer
|
||||
test_must_fail git -C wt-2 rebase conflict-2 &&
|
||||
|
||||
test_must_fail git branch -f wt-2 HEAD 2>err &&
|
||||
grep "cannot force update the branch '\''wt-2'\'' checked out at.*wt-2" err
|
||||
grep "cannot force update the branch '\''wt-2'\'' used by worktree at.*wt-2" err
|
||||
'
|
||||
|
||||
test_expect_success !SANITIZE_LEAK 'refuse to overwrite: worktree in rebase with --update-refs' '
|
||||
@ -90,7 +90,7 @@ test_expect_success !SANITIZE_LEAK 'refuse to overwrite: worktree in rebase with
|
||||
for i in 3 4
|
||||
do
|
||||
test_must_fail git branch -f can-be-updated HEAD 2>err &&
|
||||
grep "cannot force update the branch '\''can-be-updated'\'' checked out at.*wt-3" err ||
|
||||
grep "cannot force update the branch '\''can-be-updated'\'' used by worktree at.*wt-3" err ||
|
||||
return 1
|
||||
done
|
||||
'
|
||||
@ -150,7 +150,7 @@ test_expect_success 'refuse to overwrite when in error states' '
|
||||
for i in 1 2
|
||||
do
|
||||
test_must_fail git branch -f fake-$i HEAD 2>err &&
|
||||
grep "cannot force update the branch '\''fake-$i'\'' checked out at" err ||
|
||||
grep "cannot force update the branch '\''fake-$i'\'' used by worktree at" err ||
|
||||
return 1
|
||||
done
|
||||
'
|
||||
|
Reference in New Issue
Block a user