From: Junio C Hamano Date: Mon, 31 Aug 2020 22:49:50 +0000 (-0700) Subject: Merge branch 'rs/checkout-no-overlay-pathspec-fix' X-Git-Tag: v2.29.0-rc0~113 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c57afd73efcf0df974515eb97a6b1ee375107c71;p=thirdparty%2Fgit.git Merge branch 'rs/checkout-no-overlay-pathspec-fix' "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 --- c57afd73efcf0df974515eb97a6b1ee375107c71 diff --cc t/t2072-restore-pathspec-file.sh index 0d47946e8a,5468f7a7b3..b48345bf95 --- a/t/t2072-restore-pathspec-file.sh +++ b/t/t2072-restore-pathspec-file.sh @@@ -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