diff options
author | Vincent Ambo <Vincent Ambo> | 2020-01-11T23·36+0000 |
---|---|---|
committer | Vincent Ambo <Vincent Ambo> | 2020-01-11T23·40+0000 |
commit | 7ef0d62730840ded097b524104cc0a0904591a63 (patch) | |
tree | a670f96103667aeca4789a95d94ca0dff550c4ce /third_party/git/t/t9817-git-p4-exclude.sh | |
parent | 6a2a3007077818e24a3d56fc492ada9206a10cf0 (diff) | |
parent | 1b593e1ea4d2af0f6444d9a7788d5d99abd6fde5 (diff) |
merge(third_party/git): Merge squashed git subtree at v2.23.0 r/373
Merge commit '1b593e1ea4d2af0f6444d9a7788d5d99abd6fde5' as 'third_party/git'
Diffstat (limited to 'third_party/git/t/t9817-git-p4-exclude.sh')
-rwxr-xr-x | third_party/git/t/t9817-git-p4-exclude.sh | 108 |
1 files changed, 108 insertions, 0 deletions
diff --git a/third_party/git/t/t9817-git-p4-exclude.sh b/third_party/git/t/t9817-git-p4-exclude.sh new file mode 100755 index 000000000000..ec3d937c6a73 --- /dev/null +++ b/third_party/git/t/t9817-git-p4-exclude.sh @@ -0,0 +1,108 @@ +#!/bin/sh + +test_description='git p4 tests for excluded paths during clone and sync' + +. ./lib-git-p4.sh + +test_expect_success 'start p4d' ' + start_p4d +' + +# Create a repo with the structure: +# +# //depot/wanted/foo +# //depot/discard/foo +# +# Check that we can exclude a subdirectory with both +# clone and sync operations. + +test_expect_success 'create exclude repo' ' + ( + cd "$cli" && + mkdir -p wanted discard && + echo wanted >wanted/foo && + echo discard >discard/foo && + echo discard_file >discard_file && + echo discard_file_not >discard_file_not && + p4 add wanted/foo discard/foo discard_file discard_file_not && + p4 submit -d "initial revision" + ) +' + +test_expect_success 'check the repo was created correctly' ' + test_when_finished cleanup_git && + git p4 clone --dest="$git" //depot/...@all && + ( + cd "$git" && + test_path_is_file wanted/foo && + test_path_is_file discard/foo && + test_path_is_file discard_file && + test_path_is_file discard_file_not + ) +' + +test_expect_success 'clone, excluding part of repo' ' + test_when_finished cleanup_git && + git p4 clone -//depot/discard/... --dest="$git" //depot/...@all && + ( + cd "$git" && + test_path_is_file wanted/foo && + test_path_is_missing discard/foo && + test_path_is_file discard_file && + test_path_is_file discard_file_not + ) +' + +test_expect_success 'clone, excluding single file, no trailing /' ' + test_when_finished cleanup_git && + git p4 clone -//depot/discard_file --dest="$git" //depot/...@all && + ( + cd "$git" && + test_path_is_file wanted/foo && + test_path_is_file discard/foo && + test_path_is_missing discard_file && + test_path_is_file discard_file_not + ) +' + +test_expect_success 'clone, then sync with exclude' ' + test_when_finished cleanup_git && + git p4 clone -//depot/discard/... --dest="$git" //depot/...@all && + ( + cd "$cli" && + p4 edit wanted/foo discard/foo discard_file_not && + date >>wanted/foo && + date >>discard/foo && + date >>discard_file_not && + p4 submit -d "updating" && + + cd "$git" && + git p4 sync -//depot/discard/... && + test_path_is_file wanted/foo && + test_path_is_missing discard/foo && + test_path_is_file discard_file && + test_path_is_file discard_file_not + ) +' + +test_expect_success 'clone, then sync with exclude, no trailing /' ' + test_when_finished cleanup_git && + git p4 clone -//depot/discard/... -//depot/discard_file --dest="$git" //depot/...@all && + ( + cd "$cli" && + p4 edit wanted/foo discard/foo discard_file_not && + date >>wanted/foo && + date >>discard/foo && + date >>discard_file_not && + p4 submit -d "updating" && + + cd "$git" && + git p4 sync -//depot/discard/... -//depot/discard_file && + test_path_is_file wanted/foo && + test_path_is_missing discard/foo && + test_path_is_missing discard_file && + test_path_is_file discard_file_not + ) +' + +test_done |