aboutsummaryrefslogtreecommitdiff
path: root/models
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2017-11-16 22:22:38 -0500
committerUnknwon <u@gogs.io>2017-11-16 22:22:38 -0500
commit3b8b8a2ee35b5ca603f02d5eaeac8c3d7334353d (patch)
tree7c8486a3e82b20df34e1df316643aa32107f87a7 /models
parent6f04ee879ca25fd798f85a4c701291adae561a1a (diff)
pull_request: able to ignore whitespace when check conflict (#4834)
Diffstat (limited to 'models')
-rw-r--r--models/pull.go8
-rw-r--r--models/repo.go1
2 files changed, 8 insertions, 1 deletions
diff --git a/models/pull.go b/models/pull.go
index ae8f4e7d..df7c0ab6 100644
--- a/models/pull.go
+++ b/models/pull.go
@@ -392,10 +392,16 @@ func (pr *PullRequest) testPatch() (err error) {
return fmt.Errorf("UpdateLocalCopy [%d]: %v", pr.BaseRepoID, err)
}
+ args := []string{"apply", "--check"}
+ if pr.BaseRepo.PullsIgnoreWhitespace {
+ args = append(args, "--ignore-whitespace")
+ }
+ args = append(args, patchPath)
+
pr.Status = PULL_REQUEST_STATUS_CHECKING
_, stderr, err := process.ExecDir(-1, pr.BaseRepo.LocalCopyPath(),
fmt.Sprintf("testPatch (git apply --check): %d", pr.BaseRepo.ID),
- "git", "apply", "--check", patchPath)
+ "git", args...)
if err != nil {
log.Trace("PullRequest[%d].testPatch (apply): has conflit\n%s", pr.ID, stderr)
pr.Status = PULL_REQUEST_STATUS_CONFLICT
diff --git a/models/repo.go b/models/repo.go
index b770779a..50696558 100644
--- a/models/repo.go
+++ b/models/repo.go
@@ -184,6 +184,7 @@ type Repository struct {
ExternalTrackerStyle string
ExternalMetas map[string]string `xorm:"-"`
EnablePulls bool `xorm:"NOT NULL DEFAULT true"`
+ PullsIgnoreWhitespace bool `xorm:"NOT NULL DEFAULT false"`
PullsAllowRebase bool `xorm:"NOT NULL DEFAULT false"`
IsFork bool `xorm:"NOT NULL DEFAULT false"`