summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2019-03-07 09:59:51 +0900
committerLibravatar Junio C Hamano <gitster@pobox.com>2019-03-07 09:59:51 +0900
commit7d0c1f4556ad89b2f7eae97d31ea85c3bfdf7c87 (patch)
treecce91296a436de34b3f81fe0ea4b433110ec69b5 /t
parentMerge tag 'l10n-2.21.0-rnd2.1' of git://github.com/git-l10n/git-po (diff)
parentrevert "checkout: introduce checkout.overlayMode config" (diff)
downloadtgif-7d0c1f4556ad89b2f7eae97d31ea85c3bfdf7c87.tar.xz
Merge branch 'tg/checkout-no-overlay'
"git checkout --no-overlay" can be used to trigger a new mode of checking out paths out of the tree-ish, that allows paths that match the pathspec that are in the current index and working tree and are not in the tree-ish. * tg/checkout-no-overlay: revert "checkout: introduce checkout.overlayMode config" checkout: introduce checkout.overlayMode config checkout: introduce --{,no-}overlay option checkout: factor out mark_cache_entry_for_checkout function checkout: clarify comment read-cache: add invalidate parameter to remove_marked_cache_entries entry: support CE_WT_REMOVE flag in checkout_entry entry: factor out unlink_entry function move worktree tests to t24*
Diffstat (limited to 't')
-rwxr-xr-xt/t2025-checkout-no-overlay.sh47
-rwxr-xr-xt/t2400-worktree-add.sh (renamed from t/t2025-worktree-add.sh)0
-rwxr-xr-xt/t2401-worktree-prune.sh (renamed from t/t2026-worktree-prune.sh)0
-rwxr-xr-xt/t2402-worktree-list.sh (renamed from t/t2027-worktree-list.sh)0
-rwxr-xr-xt/t2403-worktree-move.sh (renamed from t/t2028-worktree-move.sh)0
-rwxr-xr-xt/t2404-worktree-config.sh (renamed from t/t2029-worktree-config.sh)0
-rwxr-xr-xt/t9902-completion.sh1
7 files changed, 48 insertions, 0 deletions
diff --git a/t/t2025-checkout-no-overlay.sh b/t/t2025-checkout-no-overlay.sh
new file mode 100755
index 0000000000..76330cb5ab
--- /dev/null
+++ b/t/t2025-checkout-no-overlay.sh
@@ -0,0 +1,47 @@
+#!/bin/sh
+
+test_description='checkout --no-overlay <tree-ish> -- <pathspec>'
+
+. ./test-lib.sh
+
+test_expect_success 'setup' '
+ git commit --allow-empty -m "initial"
+'
+
+test_expect_success 'checkout --no-overlay deletes files not in <tree-ish>' '
+ >file &&
+ mkdir dir &&
+ >dir/file1 &&
+ git add file dir/file1 &&
+ git checkout --no-overlay HEAD -- file &&
+ test_path_is_missing file &&
+ test_path_is_file dir/file1
+'
+
+test_expect_success 'checkout --no-overlay removing last file from directory' '
+ git checkout --no-overlay HEAD -- dir/file1 &&
+ test_path_is_missing dir
+'
+
+test_expect_success 'checkout -p --overlay is disallowed' '
+ test_must_fail git checkout -p --overlay HEAD 2>actual &&
+ test_i18ngrep "fatal: -p and --overlay are mutually exclusive" actual
+'
+
+test_expect_success '--no-overlay --theirs with D/F conflict deletes file' '
+ test_commit file1 file1 &&
+ test_commit file2 file2 &&
+ git rm --cached file1 &&
+ echo 1234 >file1 &&
+ F1=$(git rev-parse HEAD:file1) &&
+ F2=$(git rev-parse HEAD:file2) &&
+ {
+ echo "100644 $F1 1 file1" &&
+ echo "100644 $F2 2 file1"
+ } | git update-index --index-info &&
+ test_path_is_file file1 &&
+ git checkout --theirs --no-overlay -- file1 &&
+ test_path_is_missing file1
+'
+
+test_done
diff --git a/t/t2025-worktree-add.sh b/t/t2400-worktree-add.sh
index 286bba35d8..286bba35d8 100755
--- a/t/t2025-worktree-add.sh
+++ b/t/t2400-worktree-add.sh
diff --git a/t/t2026-worktree-prune.sh b/t/t2401-worktree-prune.sh
index b7d6d5d45a..b7d6d5d45a 100755
--- a/t/t2026-worktree-prune.sh
+++ b/t/t2401-worktree-prune.sh
diff --git a/t/t2027-worktree-list.sh b/t/t2402-worktree-list.sh
index bb6fb9b12c..bb6fb9b12c 100755
--- a/t/t2027-worktree-list.sh
+++ b/t/t2402-worktree-list.sh
diff --git a/t/t2028-worktree-move.sh b/t/t2403-worktree-move.sh
index 939d18d728..939d18d728 100755
--- a/t/t2028-worktree-move.sh
+++ b/t/t2403-worktree-move.sh
diff --git a/t/t2029-worktree-config.sh b/t/t2404-worktree-config.sh
index 286121d8de..286121d8de 100755
--- a/t/t2029-worktree-config.sh
+++ b/t/t2404-worktree-config.sh
diff --git a/t/t9902-completion.sh b/t/t9902-completion.sh
index 3a2c6326d8..f5e21bf970 100755
--- a/t/t9902-completion.sh
+++ b/t/t9902-completion.sh
@@ -1437,6 +1437,7 @@ test_expect_success 'double dash "git checkout"' '
--guess Z
--no-guess Z
--no-... Z
+ --overlay Z
EOF
'