MCPcopy Create free account
hub / github.com/docker/docker-agent / TestCreateWithEmptyBaseUsesHead

Function TestCreateWithEmptyBaseUsesHead

pkg/worktree/worktree_test.go:75–85  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

73}
74
75func TestCreateWithEmptyBaseUsesHead(t *testing.T) {
76 t.Parallel()
77 dir := bootstrapRepo(t)
78
79 head := gitOut(t, dir, "rev-parse", "HEAD")
80
81 // An empty base is ignored: the worktree branches from the current HEAD.
82 wt, err := Create(t.Context(), dir, "default-base", WithRoot(t.TempDir()), WithBase(""))
83 require.NoError(t, err)
84 assert.Equal(t, head, gitOut(t, wt.Dir, "rev-parse", "HEAD"))
85}
86
87func TestCreateWithInvalidBase(t *testing.T) {
88 t.Parallel()

Callers

nothing calls this directly

Calls 6

gitOutFunction · 0.85
CreateFunction · 0.85
WithRootFunction · 0.85
WithBaseFunction · 0.85
ContextMethod · 0.80
bootstrapRepoFunction · 0.70

Tested by

no test coverage detected