Skip to content

Commit 48b5bab

Browse files
committed
fix conflict
1 parent 8eb19a5 commit 48b5bab

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

modules/git/repo_compare.go

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -233,17 +233,6 @@ func parseDiffStat(stdout string) (numFiles, totalAdditions, totalDeletions int,
233233
return numFiles, totalAdditions, totalDeletions, err
234234
}
235235

236-
// GetDiffOrPatch generates either diff or formatted patch data between given revisions
237-
func (repo *Repository) GetDiffOrPatch(compareString string, w io.Writer, patch, binary bool) error {
238-
if patch {
239-
return repo.GetPatch(compareString, w)
240-
}
241-
if binary {
242-
return repo.GetDiffBinary(compareString, w)
243-
}
244-
return repo.GetDiff(compareString, w)
245-
}
246-
247236
func parseCompareArgs(compareArgs string) (args []string) {
248237
parts := strings.Split(compareArgs, "...")
249238
if len(parts) == 2 {

services/pull/patch.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,17 @@ import (
2929
"github.com/gobwas/glob"
3030
)
3131

32+
// getDiffOrPatch generates either diff or formatted patch data between given revisions
33+
func getDiffOrPatch(repo *git.Repository, compareString string, w io.Writer, patch, binary bool) error {
34+
if patch {
35+
return repo.GetPatch(compareString, w)
36+
}
37+
if binary {
38+
return repo.GetDiffBinary(compareString, w)
39+
}
40+
return repo.GetDiff(compareString, w)
41+
}
42+
3243
// DownloadDiffOrPatch will write the patch for the pr to the writer
3344
func DownloadDiffOrPatch(ctx context.Context, pr *issues_model.PullRequest, w io.Writer, patch, binary bool) error {
3445
if err := pr.LoadBaseRepo(ctx); err != nil {
@@ -42,7 +53,7 @@ func DownloadDiffOrPatch(ctx context.Context, pr *issues_model.PullRequest, w io
4253
}
4354
defer closer.Close()
4455

45-
if err := gitRepo.GetDiffOrPatch(pr.MergeBase+".."+pr.GetGitRefName(), w, patch, binary); err != nil {
56+
if err := getDiffOrPatch(gitRepo, pr.MergeBase+"..."+pr.GetGitRefName(), w, patch, binary); err != nil {
4657
log.Error("unable to get patch file from %s to %s in %s Error: %v", pr.MergeBase, pr.HeadBranch, pr.BaseRepo.FullName(), err)
4758
return fmt.Errorf("unable to get patch file from %s to %s in %s Error: %w", pr.MergeBase, pr.HeadBranch, pr.BaseRepo.FullName(), err)
4859
}

0 commit comments

Comments
 (0)