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