THIS IS A TEST INSTANCE ONLY! REPOSITORIES CAN BE DELETED AT ANY TIME!

Browse Source

fix duplicated file on pull request conflicted files (#7211) (#7214)

tags/v1.8.3
Lunny Xiao zeripath 5 months ago
parent
commit
7697a282d6
1 changed files with 11 additions and 1 deletions
  1. +11
    -1
      models/pull.go

+ 11
- 1
models/pull.go View File

@@ -861,7 +861,17 @@ func (pr *PullRequest) testPatch(e Engine) (err error) {
line := scanner.Text()

if strings.HasPrefix(line, prefix) {
pr.ConflictedFiles = append(pr.ConflictedFiles, strings.TrimSpace(strings.Split(line[len(prefix):], ":")[0]))
var found bool
var filepath = strings.TrimSpace(strings.Split(line[len(prefix):], ":")[0])
for _, f := range pr.ConflictedFiles {
if f == filepath {
found = true
break
}
}
if !found {
pr.ConflictedFiles = append(pr.ConflictedFiles, filepath)
}
}
// only list 10 conflicted files
if len(pr.ConflictedFiles) >= 10 {


Loading…
Cancel
Save