Skip to content

Commit a709cef

Browse files
committed
refactor: update MoveGitToTemp to use oldGitPath directly for restoring git binary
1 parent 2e5f3ae commit a709cef

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

internal/utils.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ func MoveGitToTemp(harness *test_case_harness.TestCaseHarness, logger *logger.Lo
1717
if err != nil {
1818
panic(fmt.Sprintf("CodeCrafters Internal Error: git executable not found: %v", err))
1919
}
20-
oldGitDir := path.Dir(oldGitPath)
2120

2221
tmpGitDir, err := os.MkdirTemp("/tmp", "git-*")
2322
if err != nil {
@@ -35,7 +34,7 @@ func MoveGitToTemp(harness *test_case_harness.TestCaseHarness, logger *logger.Lo
3534
}
3635

3736
// Register teardown function to automatically restore git
38-
harness.RegisterTeardownFunc(func() { restoreGit(tmpGitPath, oldGitDir) })
37+
harness.RegisterTeardownFunc(func() { restoreGit(tmpGitPath, oldGitPath) })
3938
}
4039

4140
// RestoreGit moves the git binary back to its original location and cleans up

0 commit comments

Comments
 (0)