]> git.ipfire.org Git - thirdparty/git.git/blobdiff - t/t3200-branch.sh
worktree: update is_bare heuristics
[thirdparty/git.git] / t / t3200-branch.sh
index 93f21ab078080d00100cd63f6b5ee5cdfd636d29..e9ad50b66dece121464f0638d5a4a1dd0280d121 100755 (executable)
@@ -264,6 +264,30 @@ test_expect_success 'git branch --list -d t should fail' '
        test_must_fail git rev-parse refs/heads/t
 '
 
+test_expect_success 'deleting checked-out branch from repo that is a submodule' '
+       test_when_finished "rm -rf repo1 repo2" &&
+
+       git init repo1 &&
+       git init repo1/sub &&
+       test_commit -C repo1/sub x &&
+       git -C repo1 submodule add ./sub &&
+       git -C repo1 commit -m "adding sub" &&
+
+       git clone --recurse-submodules repo1 repo2 &&
+       git -C repo2/sub checkout -b work &&
+       test_must_fail git -C repo2/sub branch -D work
+'
+
+test_expect_success 'bare main worktree has HEAD at branch deleted by secondary worktree' '
+       test_when_finished "rm -rf nonbare base secondary" &&
+
+       git init nonbare &&
+       test_commit -C nonbare x &&
+       git clone --bare nonbare bare &&
+       git -C bare worktree add --detach ../secondary master &&
+       git -C secondary branch -D master
+'
+
 test_expect_success 'git branch --list -v with --abbrev' '
        test_when_finished "git branch -D t" &&
        git branch t &&
@@ -1221,7 +1245,7 @@ test_expect_success 'use --edit-description' '
        EOF
        EDITOR=./editor git branch --edit-description &&
        echo "New contents" >expect &&
-       test_cmp EDITOR_OUTPUT expect
+       test_cmp expect EDITOR_OUTPUT
 '
 
 test_expect_success 'detect typo in branch name when using --edit-description' '