summaryrefslogtreecommitdiff
path: root/t/t2072-restore-pathspec-file.sh
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2020-08-31 22:49:50 (GMT)
committerJunio C Hamano <gitster@pobox.com>2020-08-31 22:49:50 (GMT)
commitc57afd73efcf0df974515eb97a6b1ee375107c71 (patch)
tree207740f901e4e38324120cedccb12f16db47be68 /t/t2072-restore-pathspec-file.sh
parentb9ccc5e2b445c048b2165eef0cde103eb00c1673 (diff)
parentbfda204ade8a19357cf073c98dc3a5043533b4c4 (diff)
downloadgit-c57afd73efcf0df974515eb97a6b1ee375107c71.zip
git-c57afd73efcf0df974515eb97a6b1ee375107c71.tar.gz
git-c57afd73efcf0df974515eb97a6b1ee375107c71.tar.bz2
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
Diffstat (limited to 't/t2072-restore-pathspec-file.sh')
-rwxr-xr-xt/t2072-restore-pathspec-file.sh19
1 files changed, 16 insertions, 3 deletions
diff --git a/t/t2072-restore-pathspec-file.sh b/t/t2072-restore-pathspec-file.sh
index 0d47946..b48345b 100755
--- a/t/t2072-restore-pathspec-file.sh
+++ b/t/t2072-restore-pathspec-file.sh
@@ -9,18 +9,21 @@ test_tick
test_expect_success setup '
test_commit file0 &&
+ mkdir dir1 &&
+ echo 1 >dir1/file &&
echo 1 >fileA.t &&
echo 1 >fileB.t &&
echo 1 >fileC.t &&
echo 1 >fileD.t &&
- git add fileA.t fileB.t fileC.t fileD.t &&
+ git add dir1 fileA.t fileB.t fileC.t fileD.t &&
git commit -m "files 1" &&
+ echo 2 >dir1/file &&
echo 2 >fileA.t &&
echo 2 >fileB.t &&
echo 2 >fileC.t &&
echo 2 >fileD.t &&
- git add fileA.t fileB.t fileC.t fileD.t &&
+ git add dir1 fileA.t fileB.t fileC.t fileD.t &&
git commit -m "files 2" &&
git tag checkpoint
@@ -31,7 +34,7 @@ restore_checkpoint () {
}
verify_expect () {
- git status --porcelain --untracked-files=no -- fileA.t fileB.t fileC.t fileD.t >actual &&
+ git status --porcelain --untracked-files=no -- dir1 fileA.t fileB.t fileC.t fileD.t >actual &&
test_cmp expect actual
}
@@ -161,4 +164,14 @@ test_expect_success 'error conditions' '
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