]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'rs/checkout-no-overlay-pathspec-fix'
authorJunio C Hamano <gitster@pobox.com>
Mon, 31 Aug 2020 22:49:50 +0000 (15:49 -0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 31 Aug 2020 22:49:50 +0000 (15:49 -0700)
"git restore/checkout --no-overlay" with wildcarded pathspec
mistakenly removed matching paths in subdirectories, which has been
corrected.

* rs/checkout-no-overlay-pathspec-fix:
  checkout, restore: make pathspec recursive

1  2 
builtin/checkout.c
t/t2072-restore-pathspec-file.sh

Simple merge
index 0d47946e8a9b06f044542e373f3de477e53e3261,5468f7a7b3bca8b08cbb7659ff0b81620f93ac62..b48345bf95f4a34df369d385e74e49d94be96e5f
@@@ -143,22 -139,14 +146,32 @@@ test_expect_success 'only touches what 
        verify_expect
  '
  
 +test_expect_success 'error conditions' '
 +      restore_checkpoint &&
 +      echo fileA.t >list &&
 +      >empty_list &&
 +
 +      test_must_fail git restore --pathspec-from-file=list --patch --source=HEAD^1 2>err &&
 +      test_i18ngrep -e "--pathspec-from-file is incompatible with --patch" err &&
 +
 +      test_must_fail git restore --pathspec-from-file=list --source=HEAD^1 -- fileA.t 2>err &&
 +      test_i18ngrep -e "--pathspec-from-file is incompatible with pathspec arguments" err &&
 +
 +      test_must_fail git restore --pathspec-file-nul --source=HEAD^1 2>err &&
 +      test_i18ngrep -e "--pathspec-file-nul requires --pathspec-from-file" err &&
 +
 +      test_must_fail git restore --pathspec-from-file=empty_list --source=HEAD^1 2>err &&
 +      test_i18ngrep -e "you must specify path(s) to restore" err
 +'
 +
+ test_expect_success 'wildcard pathspec matches file in subdirectory' '
+       restore_checkpoint &&
+       echo "*file" | git restore --pathspec-from-file=- --source=HEAD^1 &&
+       cat >expect <<-\EOF &&
+        M dir1/file
+       EOF
+       verify_expect
+ '
  test_done