MCPcopy Create free account
hub / github.com/LegacyCodeHQ/clarity-cli / TestIsPrimaryWorktree

Function TestIsPrimaryWorktree

vcs/git/git_worktree_test.go:75–90  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

73}
74
75func TestIsPrimaryWorktree(t *testing.T) {
76 repo := t.TempDir()
77 setupGitRepo(t, repo)
78 seedInitialCommit(t, repo)
79
80 wt := filepath.Join(t.TempDir(), "linked")
81 gitWorktreeAdd(t, repo, wt, "feat/linked")
82
83 primary, err := IsPrimaryWorktree(repo)
84 require.NoError(t, err)
85 assert.True(t, primary, "primary worktree must report IsPrimaryWorktree=true")
86
87 linked, err := IsPrimaryWorktree(wt)
88 require.NoError(t, err)
89 assert.False(t, linked, "linked worktree must report IsPrimaryWorktree=false")
90}
91
92func TestListWorktrees_PrimaryOnly(t *testing.T) {
93 repo := t.TempDir()

Callers

nothing calls this directly

Calls 4

setupGitRepoFunction · 0.85
seedInitialCommitFunction · 0.85
gitWorktreeAddFunction · 0.85
IsPrimaryWorktreeFunction · 0.85

Tested by

no test coverage detected