]> source.dussan.org Git - gitea.git/commitdiff
Avoid ambiguity of branch/directory names for the git-diff-tree command (#8066) ...
authorMura Li <typeless@users.noreply.github.com>
Tue, 3 Sep 2019 19:58:19 +0000 (03:58 +0800)
committerLauris BH <lauris.buksis@zzdats.lv>
Tue, 3 Sep 2019 19:58:19 +0000 (22:58 +0300)
modules/pull/merge.go

index cf2fb7fc4f3de4a6c06e16c9fa61780528fc5e6c..5c5ec610f362d6f6329cd0cac1b340c9aff3df80 100644 (file)
@@ -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