···
163
-
func (g *GitRepo) applyPatch(tmpDir, patchFile string, opts *MergeOptions) error {
163
+
func (g *GitRepo) applyPatch(tmpDir, patchFile string, opts MergeOptions) error {
167
+
exec.Command("git", "-C", tmpDir, "config", "advice.mergeConflict", "false").Run()
// if patch is a format-patch, apply using 'git am'
169
-
amCmd := exec.Command("git", "-C", tmpDir, "am", patchFile)
170
-
amCmd.Stderr = &stderr
171
-
if err := amCmd.Run(); err != nil {
172
-
return fmt.Errorf("patch application failed: %s", stderr.String())
177
-
// else, apply using 'git apply' and commit it manually
178
-
exec.Command("git", "-C", tmpDir, "config", "advice.mergeConflict", "false").Run()
171
+
cmd = exec.Command("git", "-C", tmpDir, "am", patchFile)
173
+
// 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...)
217
-
// If no commit message specified, use git-am which automatically creates a commit
218
-
cmd = exec.Command("git", "-C", tmpDir, "am", patchFile)
···
258
-
func (g *GitRepo) Merge(patchData []byte, targetBranch string) error {
259
-
return g.MergeWithOptions(patchData, targetBranch, nil)
262
-
func (g *GitRepo) MergeWithOptions(patchData []byte, targetBranch string, opts *MergeOptions) error {
249
+
func (g *GitRepo) MergeWithOptions(patchData []byte, targetBranch string, opts MergeOptions) error {
patchFile, err := g.createTempFileWithPatch(patchData)