|
|
@ -329,12 +329,6 @@ func (pr *PullRequest) Merge(doer *User, baseGitRepo *git.Repository) (err error |
|
|
|
return nil |
|
|
|
return nil |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// patchConflicts is a list of conflit description from Git.
|
|
|
|
|
|
|
|
var patchConflicts = []string{ |
|
|
|
|
|
|
|
"fatal:", |
|
|
|
|
|
|
|
"error:", |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// testPatch checks if patch can be merged to base repository without conflit.
|
|
|
|
// testPatch checks if patch can be merged to base repository without conflit.
|
|
|
|
// FIXME: make a mechanism to clean up stable local copies.
|
|
|
|
// FIXME: make a mechanism to clean up stable local copies.
|
|
|
|
func (pr *PullRequest) testPatch() (err error) { |
|
|
|
func (pr *PullRequest) testPatch() (err error) { |
|
|
@ -370,16 +364,10 @@ func (pr *PullRequest) testPatch() (err error) { |
|
|
|
fmt.Sprintf("testPatch (git apply --check): %d", pr.BaseRepo.ID), |
|
|
|
fmt.Sprintf("testPatch (git apply --check): %d", pr.BaseRepo.ID), |
|
|
|
"git", "apply", "--check", patchPath) |
|
|
|
"git", "apply", "--check", patchPath) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
for i := range patchConflicts { |
|
|
|
|
|
|
|
if strings.Contains(stderr, patchConflicts[i]) { |
|
|
|
|
|
|
|
log.Trace("PullRequest[%d].testPatch (apply): has conflit\n%s", pr.ID, stderr) |
|
|
|
log.Trace("PullRequest[%d].testPatch (apply): has conflit\n%s", pr.ID, stderr) |
|
|
|
pr.Status = PULL_REQUEST_STATUS_CONFLICT |
|
|
|
pr.Status = PULL_REQUEST_STATUS_CONFLICT |
|
|
|
return nil |
|
|
|
return nil |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return fmt.Errorf("git apply --check: %v - %s", err, stderr) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return nil |
|
|
|
return nil |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|