Skip to content

Commit 6aa90ce

Browse files
committed
fix: replace cp command with mv in testCloneRepository for better file handling
1 parent 209fe0a commit 6aa90ce

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,4 @@ jobs:
1717
with:
1818
python-version: '3.12'
1919
- run: make test
20+
- run: make test_with_git

debug

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Subproject commit 72f5883090a469173336debf5160727ed6025e34

internal/stage_clone_repository.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -107,27 +107,27 @@ func testCloneRepository(harness *test_case_harness.TestCaseHarness) error {
107107
defer os.RemoveAll(gitDir)
108108

109109
// Copy the custom_executable to the output path
110-
command := fmt.Sprintf("cp %s %s", gitPath, gitDir)
111-
logger.Debugf("Cp-ed git to temp directory: %s", gitDir)
110+
command := fmt.Sprintf("mv %s %s", gitPath, gitDir)
111+
logger.Debugf("mv-ed git to temp directory: %s", gitDir)
112112
//fmt.Println(command)
113113
copyCmd := exec.Command("sh", "-c", command)
114114
copyCmd.Stdout = io.Discard
115115
copyCmd.Stderr = io.Discard
116116
if err := copyCmd.Run(); err != nil {
117-
return fmt.Errorf("CodeCrafters Internal Error: cp failed: %w", err)
117+
return fmt.Errorf("CodeCrafters Internal Error: mv failed: %w", err)
118118
}
119119

120120
defer func() error {
121121
// Copy the custom_executable to the output path
122-
command := fmt.Sprintf("cp %s %s", gitDir, gitPath)
123-
logger.Debugf("Cp-ed git to temp directory: %s", gitPath)
122+
command := fmt.Sprintf("mv %s %s", gitDir, gitPath)
123+
logger.Debugf("mv-ed git to og directory: %s", gitPath)
124124
//fmt.Println(command)
125125
copyCmd := exec.Command("sh", "-c", command)
126126
copyCmd.Stdout = io.Discard
127127
copyCmd.Stderr = io.Discard
128128

129129
if err := copyCmd.Run(); err != nil {
130-
return fmt.Errorf("CodeCrafters Internal Error: cp failed: %w", err)
130+
return fmt.Errorf("CodeCrafters Internal Error: mv failed: %w", err)
131131
}
132132

133133
return nil

0 commit comments

Comments
 (0)