diff options
author | Junio C Hamano <gitster@pobox.com> | 2019-03-07 00:59:51 (GMT) |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2019-03-07 00:59:51 (GMT) |
commit | 7d0c1f4556ad89b2f7eae97d31ea85c3bfdf7c87 (patch) | |
tree | cce91296a436de34b3f81fe0ea4b433110ec69b5 /t | |
parent | 36eb1cb9cfe327583128a4b0abdf9516c2ca815b (diff) | |
parent | e92aa0e4ef5a91781530449f9466a45c16c91f7f (diff) | |
download | git-7d0c1f4556ad89b2f7eae97d31ea85c3bfdf7c87.zip git-7d0c1f4556ad89b2f7eae97d31ea85c3bfdf7c87.tar.gz git-7d0c1f4556ad89b2f7eae97d31ea85c3bfdf7c87.tar.bz2 |
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-x | t/t2025-checkout-no-overlay.sh | 47 | ||||
-rwxr-xr-x | t/t2400-worktree-add.sh (renamed from t/t2025-worktree-add.sh) | 0 | ||||
-rwxr-xr-x | t/t2401-worktree-prune.sh (renamed from t/t2026-worktree-prune.sh) | 0 | ||||
-rwxr-xr-x | t/t2402-worktree-list.sh (renamed from t/t2027-worktree-list.sh) | 0 | ||||
-rwxr-xr-x | t/t2403-worktree-move.sh (renamed from t/t2028-worktree-move.sh) | 0 | ||||
-rwxr-xr-x | t/t2404-worktree-config.sh (renamed from t/t2029-worktree-config.sh) | 0 | ||||
-rwxr-xr-x | t/t9902-completion.sh | 1 |
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 0000000..76330cb --- /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 286bba3..286bba3 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 b7d6d5d..b7d6d5d 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 bb6fb9b..bb6fb9b 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 939d18d..939d18d 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 286121d..286121d 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 3a2c632..f5e21bf 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 ' |