]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'jc/show-pathspec-fix' into maint
authorJunio C Hamano <gitster@pobox.com>
Thu, 5 May 2022 21:36:24 +0000 (14:36 -0700)
committerJunio C Hamano <gitster@pobox.com>
Thu, 5 May 2022 21:36:24 +0000 (14:36 -0700)
"git show <commit1> <commit2>... -- <pathspec>" lost the pathspec
when showing the second and subsequent commits, which has been
corrected.
source: <xmqqo80j87g0.fsf_-_@gitster.g>

* jc/show-pathspec-fix:
  2.36 show regression fix

1  2 
t/t4013-diff-various.sh

index 628b01f355a743f0d24dcc33923e72b3fa0062f9,7a44d5d5958652d496aed573896239c1225da69e..056e922164d04976570b4e5fc25975f1cbfc8b7a
@@@ -542,20 -542,25 +542,39 @@@ test_expect_success 'diff-tree --stdin 
        test_cmp expect actual
  '
  
 +test_expect_success 'diff-tree --stdin with pathspec' '
 +      cat >expect <<-EOF &&
 +      Third
 +
 +      dir/sub
 +      Second
 +
 +      dir/sub
 +      EOF
 +      git rev-list master^ |
 +      git diff-tree -r --stdin --name-only --format=%s dir >actual &&
 +      test_cmp expect actual
 +'
 +
+ test_expect_success 'show A B ... -- <pathspec>' '
+       # side touches dir/sub, file0, and file3
+       # master^ touches dir/sub, and file1
+       # master^^ touches dir/sub, file0, and file2
+       git show --name-only --format="<%s>" side master^ master^^ -- dir >actual &&
+       cat >expect <<-\EOF &&
+       <Side>
+       dir/sub
+       <Third>
+       dir/sub
+       <Second>
+       dir/sub
+       EOF
+       test_cmp expect actual
+ '
  test_expect_success 'diff -I<regex>: setup' '
        git checkout master &&
        test_seq 50 >file0 &&