Skip to content

Commit f9d4bd5

Browse files
adelowolunny
authored andcommitted
support reviewing on a deleted file path (#5880)
1 parent 1219d46 commit f9d4bd5

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

models/issue_comment.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -873,10 +873,11 @@ func CreateCodeComment(doer *User, repo *Repository, issue *Issue, content, tree
873873
// No need for get commit for base branch changes
874874
if line > 0 {
875875
commit, err := gitRepo.LineBlame(pr.GetGitRefName(), gitRepo.Path, treePath, uint(line))
876-
if err != nil {
876+
if err == nil {
877+
commitID = commit.ID.String()
878+
} else if err != nil && !strings.Contains(err.Error(), "exit status 128 - fatal: no such path") {
877879
return nil, fmt.Errorf("LineBlame[%s, %s, %s, %d]: %v", pr.GetGitRefName(), gitRepo.Path, treePath, line, err)
878880
}
879-
commitID = commit.ID.String()
880881
}
881882

882883
// Only fetch diff if comment is review comment

0 commit comments

Comments
 (0)