···
164
-
func (g *GitRepo) applyPatch(tmpDir, patchFile string, opts *MergeOptions) error {
164
+
func (g *GitRepo) applyPatch(tmpDir, patchFile string, opts MergeOptions) error {
168
+
exec.Command("git", "-C", tmpDir, "config", "advice.mergeConflict", "false").Run()
// if patch is a format-patch, apply using 'git am'
170
-
amCmd := exec.Command("git", "-C", tmpDir, "am", patchFile)
171
-
amCmd.Stderr = &stderr
172
-
if err := amCmd.Run(); err != nil {
173
-
return fmt.Errorf("patch application failed: %s", stderr.String())
178
-
// else, apply using 'git apply' and commit it manually
179
-
exec.Command("git", "-C", tmpDir, "config", "advice.mergeConflict", "false").Run()
172
+
cmd = exec.Command("git", "-C", tmpDir, "am", patchFile)
174
+
// else, apply using 'git apply' and commit it manually
applyCmd := exec.Command("git", "-C", tmpDir, "apply", patchFile)
applyCmd.Stderr = &stderr
if err := applyCmd.Run(); err != nil {
···
cmd = exec.Command("git", commitArgs...)
218
-
// If no commit message specified, use git-am which automatically creates a commit
219
-
cmd = exec.Command("git", "-C", tmpDir, "am", patchFile)
···
259
-
func (g *GitRepo) Merge(patchData []byte, targetBranch string) error {
260
-
return g.MergeWithOptions(patchData, targetBranch, nil)
263
-
func (g *GitRepo) MergeWithOptions(patchData []byte, targetBranch string, opts *MergeOptions) error {
250
+
func (g *GitRepo) MergeWithOptions(patchData []byte, targetBranch string, opts MergeOptions) error {
patchFile, err := g.createTempFileWithPatch(patchData)