support reviewing on a deleted file path (#5880)
This commit is contained in:
parent
1219d46b02
commit
f9d4bd53e6
1 changed files with 3 additions and 2 deletions
|
@ -873,10 +873,11 @@ func CreateCodeComment(doer *User, repo *Repository, issue *Issue, content, tree
|
||||||
// No need for get commit for base branch changes
|
// No need for get commit for base branch changes
|
||||||
if line > 0 {
|
if line > 0 {
|
||||||
commit, err := gitRepo.LineBlame(pr.GetGitRefName(), gitRepo.Path, treePath, uint(line))
|
commit, err := gitRepo.LineBlame(pr.GetGitRefName(), gitRepo.Path, treePath, uint(line))
|
||||||
if err != nil {
|
if err == nil {
|
||||||
|
commitID = commit.ID.String()
|
||||||
|
} else if err != nil && !strings.Contains(err.Error(), "exit status 128 - fatal: no such path") {
|
||||||
return nil, fmt.Errorf("LineBlame[%s, %s, %s, %d]: %v", pr.GetGitRefName(), gitRepo.Path, treePath, line, err)
|
return nil, fmt.Errorf("LineBlame[%s, %s, %s, %d]: %v", pr.GetGitRefName(), gitRepo.Path, treePath, line, err)
|
||||||
}
|
}
|
||||||
commitID = commit.ID.String()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Only fetch diff if comment is review comment
|
// Only fetch diff if comment is review comment
|
||||||
|
|
Reference in a new issue