Skip to content

Commit bcb4bcb

Browse files
feat: patching now runs git apply
1 parent 9fd576e commit bcb4bcb

1 file changed

Lines changed: 17 additions & 2 deletions

File tree

internal/git/patches.go

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,37 @@ package git
22

33
import "fmt"
44

5-
func checkPatchValidity(patchFile string) error {
5+
func checkPatchValidity(filePath string) error {
66
checkApplyArgs := append(
77
[]string{
88
"apply",
99
"--check",
1010
},
11-
patchFile,
11+
filePath,
1212
)
1313

1414
return executeGitCommand(checkApplyArgs)
1515
}
1616

17+
func patchFile(filePath string) error {
18+
patchFileArgs := append(
19+
[]string{
20+
"apply",
21+
},
22+
filePath,
23+
)
24+
25+
return executeGitCommand(patchFileArgs)
26+
}
27+
1728
func ApplyPatches(filesToPatch []string) error {
1829
for _, filePath := range filesToPatch {
1930
if err := checkPatchValidity(filePath); err != nil {
2031
fmt.Printf("\t[Error] while trying to patch file %s : %s\n", filePath, err.Error())
32+
continue
33+
}
34+
if err := patchFile(filePath); err != nil {
35+
fmt.Printf("\t[Error] while trying to patch file %s : %s\n", filePath, err.Error())
2136
}
2237
}
2338

0 commit comments

Comments
 (0)