Skip to content

Commit 58d24ab

Browse files
committed
update comment, use name SyncUserSpecificDiff
1 parent f609256 commit 58d24ab

File tree

3 files changed

+5
-7
lines changed

3 files changed

+5
-7
lines changed

routers/web/repo/pull.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -764,9 +764,9 @@ func viewPullFiles(ctx *context.Context, specifiedStartCommit, specifiedEndCommi
764764
// do nothing
765765
} else {
766766
shouldGetUserSpecificDiff = true
767-
err = gitdiff.SyncAndGetUserSpecificDiff(ctx, ctx.Doer.ID, pull, gitRepo, diff, diffOptions, files...)
767+
err = gitdiff.SyncUserSpecificDiff(ctx, ctx.Doer.ID, pull, gitRepo, diff, diffOptions, files...)
768768
if err != nil {
769-
ctx.ServerError("SyncAndGetUserSpecificDiff", err)
769+
ctx.ServerError("SyncUserSpecificDiff", err)
770770
return
771771
}
772772
}

services/gitdiff/gitdiff.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1251,9 +1251,9 @@ func GetDiffShortStat(gitRepo *git.Repository, beforeCommitID, afterCommitID str
12511251
return diff, nil
12521252
}
12531253

1254-
// SyncAndGetUserSpecificDiff is like GetDiff, except that user specific data such as which files the given user has already viewed on the given PR will also be set
1255-
// Additionally, the database asynchronously is updated if files have changed since the last review
1256-
func SyncAndGetUserSpecificDiff(ctx context.Context, userID int64, pull *issues_model.PullRequest, gitRepo *git.Repository, diff *Diff, opts *DiffOptions, files ...string) error {
1254+
// SyncUserSpecificDiff inserts user-specific data such as which files the user has already viewed on the given diff
1255+
// Additionally, the database is updated asynchronously if files have changed since the last review
1256+
func SyncUserSpecificDiff(ctx context.Context, userID int64, pull *issues_model.PullRequest, gitRepo *git.Repository, diff *Diff, opts *DiffOptions, files ...string) error {
12571257
review, err := pull_model.GetNewestReviewState(ctx, userID, pull.ID)
12581258
if err != nil || review == nil || review.UpdatedFiles == nil {
12591259
return err

services/repository/files/temp_repo.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -409,8 +409,6 @@ func (t *TemporaryUploadRepository) DiffIndex() (*gitdiff.Diff, error) {
409409
return nil, fmt.Errorf("unable to run diff-index pipeline in temporary repo: %w", err)
410410
}
411411

412-
// Legacy code tried to get "diff --shortstat", but it seems to be unnecessary
413-
// diff.NumFiles, diff.TotalAddition, diff.TotalDeletion, err = git.GetDiffShortStat(t.ctx, t.basePath, git.TrustedCmdArgs{"--cached"}, "HEAD")
414412
return diff, nil
415413
}
416414

0 commit comments

Comments
 (0)