| 256 | } |
| 257 | |
| 258 | func 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 | |
| 277 | func TestRemove(t *testing.T) { |
| 278 | t.Parallel() |