diff options
Diffstat (limited to 't/t2025-worktree-add.sh')
-rwxr-xr-x | t/t2025-worktree-add.sh | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/t/t2025-worktree-add.sh b/t/t2025-worktree-add.sh index 2240498924..166942c1bd 100755 --- a/t/t2025-worktree-add.sh +++ b/t/t2025-worktree-add.sh @@ -402,6 +402,26 @@ test_expect_success '"add" <path> <branch> dwims' ' ) ' +test_expect_success '"add" <path> <branch> dwims with checkout.defaultRemote' ' + test_when_finished rm -rf repo_upstream repo_dwim foo && + setup_remote_repo repo_upstream repo_dwim && + git init repo_dwim && + ( + cd repo_dwim && + git remote add repo_upstream2 ../repo_upstream && + git fetch repo_upstream2 && + test_must_fail git worktree add ../foo foo && + git -c checkout.defaultRemote=repo_upstream worktree add ../foo foo && + git status -uno --porcelain >status.actual && + test_must_be_empty status.actual + ) && + ( + cd foo && + test_branch_upstream foo repo_upstream foo && + test_cmp_rev refs/remotes/repo_upstream/foo refs/heads/foo + ) +' + test_expect_success 'git worktree add does not match remote' ' test_when_finished rm -rf repo_a repo_b foo && setup_remote_repo repo_a repo_b && @@ -477,7 +497,7 @@ post_checkout_hook () { test_expect_success '"add" invokes post-checkout hook (branch)' ' post_checkout_hook && { - echo $_z40 $(git rev-parse HEAD) 1 && + echo $ZERO_OID $(git rev-parse HEAD) 1 && echo $(pwd)/.git/worktrees/gumby && echo $(pwd)/gumby } >hook.expect && @@ -488,7 +508,7 @@ test_expect_success '"add" invokes post-checkout hook (branch)' ' test_expect_success '"add" invokes post-checkout hook (detached)' ' post_checkout_hook && { - echo $_z40 $(git rev-parse HEAD) 1 && + echo $ZERO_OID $(git rev-parse HEAD) 1 && echo $(pwd)/.git/worktrees/grumpy && echo $(pwd)/grumpy } >hook.expect && @@ -506,7 +526,7 @@ test_expect_success '"add --no-checkout" suppresses post-checkout hook' ' test_expect_success '"add" in other worktree invokes post-checkout hook' ' post_checkout_hook && { - echo $_z40 $(git rev-parse HEAD) 1 && + echo $ZERO_OID $(git rev-parse HEAD) 1 && echo $(pwd)/.git/worktrees/guppy && echo $(pwd)/guppy } >hook.expect && @@ -518,7 +538,7 @@ test_expect_success '"add" in bare repo invokes post-checkout hook' ' rm -rf bare && git clone --bare . bare && { - echo $_z40 $(git --git-dir=bare rev-parse HEAD) 1 && + echo $ZERO_OID $(git --git-dir=bare rev-parse HEAD) 1 && echo $(pwd)/bare/worktrees/goozy && echo $(pwd)/goozy } >hook.expect && |