From e7f6da386f224c7095b53e6db006be5ec2926e34 Mon Sep 17 00:00:00 2001 From: Mura Li Date: Wed, 4 Sep 2019 03:58:19 +0800 Subject: [PATCH] Avoid ambiguity of branch/directory names for the git-diff-tree command (#8066) (#8070) --- modules/pull/merge.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/modules/pull/merge.go b/modules/pull/merge.go index cf2fb7fc4f..5c5ec610f3 100644 --- a/modules/pull/merge.go +++ b/modules/pull/merge.go @@ -299,8 +299,7 @@ func getDiffTree(repoPath, baseBranch, headBranch string) (string, error) { getDiffTreeFromBranch := func(repoPath, baseBranch, headBranch string) (string, error) { var outbuf, errbuf strings.Builder // Compute the diff-tree for sparse-checkout - // The branch argument must be enclosed with double-quotes ("") in case it contains slashes (e.g "feature/test") - if err := git.NewCommand("diff-tree", "--no-commit-id", "--name-only", "-r", "--root", baseBranch, headBranch).RunInDirPipeline(repoPath, &outbuf, &errbuf); err != nil { + if err := git.NewCommand("diff-tree", "--no-commit-id", "--name-only", "-r", "--root", baseBranch, headBranch, "--").RunInDirPipeline(repoPath, &outbuf, &errbuf); err != nil { return "", fmt.Errorf("git diff-tree [%s base:%s head:%s]: %s", repoPath, baseBranch, headBranch, errbuf.String()) } return outbuf.String(), nil -- 2.39.5