diff options
author | 6543 <6543@obermui.de> | 2022-04-25 20:45:18 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-25 20:45:18 +0200 |
commit | 1ebb30e41bf3b44404d7d03a5541729762c226b5 (patch) | |
tree | e549366c1166082c22784b85633a90d5dd56e91f /modules | |
parent | 7c164d5a918c2461bbdf2a1ef79a20908c3259be (diff) | |
download | gitea-1ebb30e41bf3b44404d7d03a5541729762c226b5.tar.gz gitea-1ebb30e41bf3b44404d7d03a5541729762c226b5.zip |
Pass gitRepo down to GetRawDiff, since its used for main repo and wiki (#19461)
as per https://github.com/go-gitea/gitea/pull/19449#issuecomment-1105283931
pass gitRepo down to GetRawDiff, since its used for main repo and wiki
Diffstat (limited to 'modules')
-rw-r--r-- | modules/git/diff.go | 15 |
1 files changed, 2 insertions, 13 deletions
diff --git a/modules/git/diff.go b/modules/git/diff.go index e11f63cabd..c9d68bb130 100644 --- a/modules/git/diff.go +++ b/modules/git/diff.go @@ -28,8 +28,8 @@ const ( ) // GetRawDiff dumps diff results of repository in given commit ID to io.Writer. -func GetRawDiff(ctx context.Context, repoPath, commitID string, diffType RawDiffType, writer io.Writer) error { - return GetRawDiffForFile(ctx, repoPath, "", commitID, diffType, "", writer) +func GetRawDiff(repo *Repository, commitID string, diffType RawDiffType, writer io.Writer) error { + return GetRepoRawDiffForFile(repo, "", commitID, diffType, "", writer) } // GetReverseRawDiff dumps the reverse diff results of repository in given commit ID to io.Writer. @@ -46,17 +46,6 @@ func GetReverseRawDiff(ctx context.Context, repoPath, commitID string, writer io return nil } -// GetRawDiffForFile dumps diff results of file in given commit ID to io.Writer. -func GetRawDiffForFile(ctx context.Context, repoPath, startCommit, endCommit string, diffType RawDiffType, file string, writer io.Writer) error { - repo, closer, err := RepositoryFromContextOrOpen(ctx, repoPath) - if err != nil { - return fmt.Errorf("RepositoryFromContextOrOpen: %v", err) - } - defer closer.Close() - - return GetRepoRawDiffForFile(repo, startCommit, endCommit, diffType, file, writer) -} - // GetRepoRawDiffForFile dumps diff results of file in given commit ID to io.Writer according given repository func GetRepoRawDiffForFile(repo *Repository, startCommit, endCommit string, diffType RawDiffType, file string, writer io.Writer) error { commit, err := repo.GetCommit(endCommit) |