Parcourir la source

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

tags/v1.9.0-rc1
Lunny Xiao il y a 5 ans
Parent
révision
0323122fd7
1 fichiers modifiés avec 11 ajouts et 1 suppressions
  1. 11
    1
      models/pull.go

+ 11
- 1
models/pull.go Voir le fichier

@@ -863,7 +863,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 {

Chargement…
Annuler
Enregistrer