diff options
author | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2016-04-22 20:01:36 +0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-04-22 14:09:39 -0700 |
commit | 14ace5b77b493506a1f8ffde96a2f49cc7bc4db0 (patch) | |
tree | 50c5dee66f1f65027675b1d2e187fc418f2831e6 /t/t2025-worktree-add.sh | |
parent | worktree.c: check whether branch is bisected in another worktree (diff) | |
download | tgif-14ace5b77b493506a1f8ffde96a2f49cc7bc4db0.tar.xz |
branch: do not rename a branch under bisect or rebase
The branch name in that case could be saved in rebase's head_name or
bisect's BISECT_START files. Ideally we should try to update them as
well. But it's trickier (*). Let's play safe and see if the user
complains about inconveniences before doing that.
(*) If we do it, bisect and rebase need to provide an API to rename
branches. We can't do it in worktree.c or builtin/branch.c because
when other people change rebase/bisect code, they may not be aware of
this code and accidentally break it (e.g. rename the branch file, or
refer to the branch in new files). It's a lot more work.
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t2025-worktree-add.sh')
-rwxr-xr-x | t/t2025-worktree-add.sh | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/t/t2025-worktree-add.sh b/t/t2025-worktree-add.sh index 8f53944cb2..3a22fc55fc 100755 --- a/t/t2025-worktree-add.sh +++ b/t/t2025-worktree-add.sh @@ -254,6 +254,10 @@ test_expect_success 'not allow to delete a branch under rebase' ' ) ' +test_expect_success 'rename a branch under rebase not allowed' ' + test_must_fail git branch -M under-rebase rebase-with-new-name +' + test_expect_success 'check out from current worktree branch ok' ' ( cd under-rebase && @@ -276,4 +280,8 @@ test_expect_success 'checkout a branch under bisect' ' ) ' +test_expect_success 'rename a branch under bisect not allowed' ' + test_must_fail git branch -M under-bisect bisect-with-new-name +' + test_done |