Merge branch 'jc/ci-upload-artifact-and-linux32'
[git/gitster.git] / t / t9817-git-p4-exclude.sh
blob3deb334fed1c6aa068861e4e1c196e9c0edf39f1
1 #!/bin/sh
3 test_description='git p4 tests for excluded paths during clone and sync'
5 TEST_PASSES_SANITIZE_LEAK=true
6 . ./lib-git-p4.sh
8 test_expect_success 'start p4d' '
9 start_p4d
12 # Create a repo with the structure:
14 # //depot/wanted/foo
15 # //depot/discard/foo
17 # Check that we can exclude a subdirectory with both
18 # clone and sync operations.
20 test_expect_success 'create exclude repo' '
22 cd "$cli" &&
23 mkdir -p wanted discard &&
24 echo wanted >wanted/foo &&
25 echo discard >discard/foo &&
26 echo discard_file >discard_file &&
27 echo discard_file_not >discard_file_not &&
28 p4 add wanted/foo discard/foo discard_file discard_file_not &&
29 p4 submit -d "initial revision"
33 test_expect_success 'check the repo was created correctly' '
34 test_when_finished cleanup_git &&
35 git p4 clone --dest="$git" //depot/...@all &&
37 cd "$git" &&
38 test_path_is_file wanted/foo &&
39 test_path_is_file discard/foo &&
40 test_path_is_file discard_file &&
41 test_path_is_file discard_file_not
45 test_expect_success 'clone, excluding part of repo' '
46 test_when_finished cleanup_git &&
47 git p4 clone -//depot/discard/... --dest="$git" //depot/...@all &&
49 cd "$git" &&
50 test_path_is_file wanted/foo &&
51 test_path_is_missing discard/foo &&
52 test_path_is_file discard_file &&
53 test_path_is_file discard_file_not
57 test_expect_success 'clone, excluding single file, no trailing /' '
58 test_when_finished cleanup_git &&
59 git p4 clone -//depot/discard_file --dest="$git" //depot/...@all &&
61 cd "$git" &&
62 test_path_is_file wanted/foo &&
63 test_path_is_file discard/foo &&
64 test_path_is_missing discard_file &&
65 test_path_is_file discard_file_not
69 test_expect_success 'clone, then sync with exclude' '
70 test_when_finished cleanup_git &&
71 git p4 clone -//depot/discard/... --dest="$git" //depot/...@all &&
73 cd "$cli" &&
74 p4 edit wanted/foo discard/foo discard_file_not &&
75 date >>wanted/foo &&
76 date >>discard/foo &&
77 date >>discard_file_not &&
78 p4 submit -d "updating" &&
80 cd "$git" &&
81 git p4 sync -//depot/discard/... &&
82 test_path_is_file wanted/foo &&
83 test_path_is_missing discard/foo &&
84 test_path_is_file discard_file &&
85 test_path_is_file discard_file_not
89 test_expect_success 'clone, then sync with exclude, no trailing /' '
90 test_when_finished cleanup_git &&
91 git p4 clone -//depot/discard/... -//depot/discard_file --dest="$git" //depot/...@all &&
93 cd "$cli" &&
94 p4 edit wanted/foo discard/foo discard_file_not &&
95 date >>wanted/foo &&
96 date >>discard/foo &&
97 date >>discard_file_not &&
98 p4 submit -d "updating" &&
100 cd "$git" &&
101 git p4 sync -//depot/discard/... -//depot/discard_file &&
102 test_path_is_file wanted/foo &&
103 test_path_is_missing discard/foo &&
104 test_path_is_missing discard_file &&
105 test_path_is_file discard_file_not
109 test_done