mirror of
https://github.com/go-gitea/gitea
synced 2025-01-24 10:47:47 +01:00
fix conflict
This commit is contained in:
parent
8eb19a5ae1
commit
48b5bab880
@ -233,17 +233,6 @@ func parseDiffStat(stdout string) (numFiles, totalAdditions, totalDeletions int,
|
||||
return numFiles, totalAdditions, totalDeletions, err
|
||||
}
|
||||
|
||||
// GetDiffOrPatch generates either diff or formatted patch data between given revisions
|
||||
func (repo *Repository) GetDiffOrPatch(compareString string, w io.Writer, patch, binary bool) error {
|
||||
if patch {
|
||||
return repo.GetPatch(compareString, w)
|
||||
}
|
||||
if binary {
|
||||
return repo.GetDiffBinary(compareString, w)
|
||||
}
|
||||
return repo.GetDiff(compareString, w)
|
||||
}
|
||||
|
||||
func parseCompareArgs(compareArgs string) (args []string) {
|
||||
parts := strings.Split(compareArgs, "...")
|
||||
if len(parts) == 2 {
|
||||
|
@ -29,6 +29,17 @@ import (
|
||||
"github.com/gobwas/glob"
|
||||
)
|
||||
|
||||
// getDiffOrPatch generates either diff or formatted patch data between given revisions
|
||||
func getDiffOrPatch(repo *git.Repository, compareString string, w io.Writer, patch, binary bool) error {
|
||||
if patch {
|
||||
return repo.GetPatch(compareString, w)
|
||||
}
|
||||
if binary {
|
||||
return repo.GetDiffBinary(compareString, w)
|
||||
}
|
||||
return repo.GetDiff(compareString, w)
|
||||
}
|
||||
|
||||
// DownloadDiffOrPatch will write the patch for the pr to the writer
|
||||
func DownloadDiffOrPatch(ctx context.Context, pr *issues_model.PullRequest, w io.Writer, patch, binary bool) error {
|
||||
if err := pr.LoadBaseRepo(ctx); err != nil {
|
||||
@ -42,7 +53,7 @@ func DownloadDiffOrPatch(ctx context.Context, pr *issues_model.PullRequest, w io
|
||||
}
|
||||
defer closer.Close()
|
||||
|
||||
if err := gitRepo.GetDiffOrPatch(pr.MergeBase+".."+pr.GetGitRefName(), w, patch, binary); err != nil {
|
||||
if err := getDiffOrPatch(gitRepo, pr.MergeBase+"..."+pr.GetGitRefName(), w, patch, binary); err != nil {
|
||||
log.Error("unable to get patch file from %s to %s in %s Error: %v", pr.MergeBase, pr.HeadBranch, pr.BaseRepo.FullName(), err)
|
||||
return fmt.Errorf("unable to get patch file from %s to %s in %s Error: %w", pr.MergeBase, pr.HeadBranch, pr.BaseRepo.FullName(), err)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user