Skip to content

Commit e7f6da3

Browse files
typelesslafriks
authored andcommitted
Avoid ambiguity of branch/directory names for the git-diff-tree command (#8066) (#8070)
1 parent 7727f84 commit e7f6da3

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

modules/pull/merge.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -299,8 +299,7 @@ func getDiffTree(repoPath, baseBranch, headBranch string) (string, error) {
299299
getDiffTreeFromBranch := func(repoPath, baseBranch, headBranch string) (string, error) {
300300
var outbuf, errbuf strings.Builder
301301
// Compute the diff-tree for sparse-checkout
302-
// The branch argument must be enclosed with double-quotes ("") in case it contains slashes (e.g "feature/test")
303-
if err := git.NewCommand("diff-tree", "--no-commit-id", "--name-only", "-r", "--root", baseBranch, headBranch).RunInDirPipeline(repoPath, &outbuf, &errbuf); err != nil {
302+
if err := git.NewCommand("diff-tree", "--no-commit-id", "--name-only", "-r", "--root", baseBranch, headBranch, "--").RunInDirPipeline(repoPath, &outbuf, &errbuf); err != nil {
304303
return "", fmt.Errorf("git diff-tree [%s base:%s head:%s]: %s", repoPath, baseBranch, headBranch, errbuf.String())
305304
}
306305
return outbuf.String(), nil

0 commit comments

Comments
 (0)