summaryrefslogtreecommitdiffstats
path: root/services/pull
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2020-01-28 16:02:03 +0800
committerzeripath <art27@cantab.net>2020-01-28 08:02:03 +0000
commite8860ef4f9fe84aac856e354a897734aac7c279b (patch)
tree09b7248b5115972f0f1e8be9f5b9dcdc7d7f8d72 /services/pull
parent1019913eaba0e8ad3a67174a1a13c673ee832406 (diff)
downloadgitea-e8860ef4f9fe84aac856e354a897734aac7c279b.tar.gz
gitea-e8860ef4f9fe84aac856e354a897734aac7c279b.zip
Some refactor on git diff and ignore getting commit information failed on migrating pull request review comments (#9996)
* Some refactor on git diff and ignore getting commit information failed on migrating pull request review comments * fix test * fix lint * Change error log to warn
Diffstat (limited to 'services/pull')
-rw-r--r--services/pull/review.go5
1 files changed, 2 insertions, 3 deletions
diff --git a/services/pull/review.go b/services/pull/review.go
index 2bc8240230..2b7c9e8646 100644
--- a/services/pull/review.go
+++ b/services/pull/review.go
@@ -14,7 +14,6 @@ import (
"code.gitea.io/gitea/modules/git"
"code.gitea.io/gitea/modules/notification"
"code.gitea.io/gitea/modules/setting"
- "code.gitea.io/gitea/services/gitdiff"
)
// CreateCodeComment creates a comment on the code line
@@ -140,10 +139,10 @@ func createCodeComment(doer *models.User, repo *models.Repository, issue *models
return nil, fmt.Errorf("GetRefCommitID[%s]: %v", pr.GetGitRefName(), err)
}
patchBuf := new(bytes.Buffer)
- if err := gitdiff.GetRawDiffForFile(gitRepo.Path, pr.MergeBase, headCommitID, gitdiff.RawDiffNormal, treePath, patchBuf); err != nil {
+ if err := git.GetRepoRawDiffForFile(gitRepo, pr.MergeBase, headCommitID, git.RawDiffNormal, treePath, patchBuf); err != nil {
return nil, fmt.Errorf("GetRawDiffForLine[%s, %s, %s, %s]: %v", err, gitRepo.Path, pr.MergeBase, headCommitID, treePath)
}
- patch = gitdiff.CutDiffAroundLine(patchBuf, int64((&models.Comment{Line: line}).UnsignedLine()), line < 0, setting.UI.CodeCommentLines)
+ patch = git.CutDiffAroundLine(patchBuf, int64((&models.Comment{Line: line}).UnsignedLine()), line < 0, setting.UI.CodeCommentLines)
}
return models.CreateComment(&models.CreateCommentOptions{
Type: models.CommentTypeCode,