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

Function TestGetUncommittedFiles_RenamedFiles

vcs/git/git_diff_test.go:231–261  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

229}
230
231func TestGetUncommittedFiles_RenamedFiles(t *testing.T) {
232 tmpDir := t.TempDir()
233 setupGitRepo(t, tmpDir)
234
235 // Create files and commit them
236 createFile(t, tmpDir, "app.ts", "const app = 'hello';\n")
237 createFile(t, tmpDir, "preload.ts", "const preload = true;\n")
238 gitAdd(t, tmpDir, "app.ts")
239 gitAdd(t, tmpDir, "preload.ts")
240 gitCommit(t, tmpDir, "Initial commit")
241
242 // Create subdirectory and rename files using git mv
243 srcDir := filepath.Join(tmpDir, "src")
244 err := os.Mkdir(srcDir, 0755)
245 require.NoError(t, err)
246
247 cmd := exec.Command("git", "mv", "app.ts", "src/app.ts")
248 cmd.Dir = tmpDir
249 require.NoError(t, cmd.Run())
250
251 cmd = exec.Command("git", "mv", "preload.ts", "src/preload.ts")
252 cmd.Dir = tmpDir
253 require.NoError(t, cmd.Run())
254
255 // Get uncommitted files
256 files, err := GetUncommittedFiles(tmpDir)
257
258 require.NoError(t, err)
259 g := testhelpers.TextGoldie(t)
260 g.Assert(t, t.Name(), []byte(normalizeFilePaths(tmpDir, files)))
261}
262
263// Tests for GetCommitDartFiles
264

Callers

nothing calls this directly

Calls 8

TextGoldieFunction · 0.92
setupGitRepoFunction · 0.85
createFileFunction · 0.85
gitAddFunction · 0.85
gitCommitFunction · 0.85
GetUncommittedFilesFunction · 0.85
normalizeFilePathsFunction · 0.85
NameMethod · 0.65

Tested by

no test coverage detected