Skip to content

Commit 0323122

Browse files
lunnyzeripath
authored andcommitted
fix duplicated file on pull request conflicted files (#7211)
1 parent 94ceaf1 commit 0323122

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

models/pull.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -863,7 +863,17 @@ func (pr *PullRequest) testPatch(e Engine) (err error) {
863863
line := scanner.Text()
864864

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

0 commit comments

Comments
 (0)