Skip to content

Commit 7697a28

Browse files
lunnyzeripath
authored andcommitted
fix duplicated file on pull request conflicted files (#7211) (#7214)
1 parent 76e8eec commit 7697a28

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

models/pull.go

+11-1
Original file line numberDiff line numberDiff line change
@@ -861,7 +861,17 @@ func (pr *PullRequest) testPatch(e Engine) (err error) {
861861
line := scanner.Text()
862862

863863
if strings.HasPrefix(line, prefix) {
864-
pr.ConflictedFiles = append(pr.ConflictedFiles, strings.TrimSpace(strings.Split(line[len(prefix):], ":")[0]))
864+
var found bool
865+
var filepath = strings.TrimSpace(strings.Split(line[len(prefix):], ":")[0])
866+
for _, f := range pr.ConflictedFiles {
867+
if f == filepath {
868+
found = true
869+
break
870+
}
871+
}
872+
if !found {
873+
pr.ConflictedFiles = append(pr.ConflictedFiles, filepath)
874+
}
865875
}
866876
// only list 10 conflicted files
867877
if len(pr.ConflictedFiles) >= 10 {

0 commit comments

Comments
 (0)