aboutsummaryrefslogtreecommitdiffstats
path: root/modules/repofiles/temp_repo.go
diff options
context:
space:
mode:
authorzeripath <art27@cantab.net>2020-10-14 12:27:21 +0100
committerGitHub <noreply@github.com>2020-10-14 14:27:21 +0300
commit99fb2564118286a5fc2db5676b44029a96a14087 (patch)
tree958a3a3b47dce08e36822af9ad4f6dda17df99a2 /modules/repofiles/temp_repo.go
parent09abdb8a65ee1e935a63add6d7f6398d36be7ebe (diff)
downloadgitea-99fb2564118286a5fc2db5676b44029a96a14087.tar.gz
gitea-99fb2564118286a5fc2db5676b44029a96a14087.zip
Finally fix diff names (#13136) (#13139)
Backport #13136 it is possible to have an ambiguous line here. if they needed to be and if one was quoted then both would be. Both of these were wrong. I have now discovered `--src-prefix` and `--dst-prefix` which means that we can set this in such a way to force the git diff to always be unambiguous. Therefore this PR rollsback most of the changes in #12771 and uses these options to fix this. Signed-off-by: Andrew Thornton <art27@cantab.net>
Diffstat (limited to 'modules/repofiles/temp_repo.go')
-rw-r--r--modules/repofiles/temp_repo.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/modules/repofiles/temp_repo.go b/modules/repofiles/temp_repo.go
index 89f9b0b208..ca35b51c29 100644
--- a/modules/repofiles/temp_repo.go
+++ b/modules/repofiles/temp_repo.go
@@ -278,7 +278,7 @@ func (t *TemporaryUploadRepository) DiffIndex() (*gitdiff.Diff, error) {
var diff *gitdiff.Diff
var finalErr error
- if err := git.NewCommand("diff-index", "--cached", "-p", "HEAD").
+ if err := git.NewCommand("diff-index", "--src-prefix=\\a/", "--dst-prefix=\\b/", "--cached", "-p", "HEAD").
RunInDirTimeoutEnvFullPipelineFunc(nil, 30*time.Second, t.basePath, stdoutWriter, stderr, nil, func(ctx context.Context, cancel context.CancelFunc) error {
_ = stdoutWriter.Close()
diff, finalErr = gitdiff.ParsePatch(setting.Git.MaxGitDiffLines, setting.Git.MaxGitDiffLineCharacters, setting.Git.MaxGitDiffFiles, stdoutReader)