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

Function TestStatusDetectsNewCommits

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

Source from the content-addressed store, hash-verified

256}
257
258func TestStatusDetectsNewCommits(t *testing.T) {
259 t.Parallel()
260 dir := bootstrapRepo(t)
261
262 wt, err := Create(t.Context(), dir, "committed", WithRoot(t.TempDir()))
263 require.NoError(t, err)
264
265 require.NoError(t, os.WriteFile(filepath.Join(wt.Dir, "a.txt"), []byte("changed"), 0o644))
266 runGit(t, wt.Dir, "commit", "-am", "work")
267
268 st, err := wt.Status(t.Context())
269 require.NoError(t, err)
270 assert.True(t, st.IsDirty())
271 assert.True(t, st.NewCommits)
272 // A committed change leaves a clean tree.
273 assert.False(t, st.Modified)
274 assert.False(t, st.Untracked)
275}
276
277func TestRemove(t *testing.T) {
278 t.Parallel()

Callers

nothing calls this directly

Calls 7

CreateFunction · 0.85
WithRootFunction · 0.85
ContextMethod · 0.80
StatusMethod · 0.80
IsDirtyMethod · 0.80
bootstrapRepoFunction · 0.70
runGitFunction · 0.70

Tested by

no test coverage detected