Merge branch 'sb/submodule-module-list-pathspec-fix'
[alt-git.git] / t / t9817-git-p4-exclude.sh
blobaac568eadfcab6198877d211d3e706cead68e302
1 #!/bin/sh
3 test_description='git p4 tests for excluded paths during clone and sync'
5 . ./lib-git-p4.sh
7 test_expect_success 'start p4d' '
8 start_p4d
11 # Create a repo with the structure:
13 # //depot/wanted/foo
14 # //depot/discard/foo
16 # Check that we can exclude a subdirectory with both
17 # clone and sync operations.
19 test_expect_success 'create exclude repo' '
21 cd "$cli" &&
22 mkdir -p wanted discard &&
23 echo wanted >wanted/foo &&
24 echo discard >discard/foo &&
25 p4 add wanted/foo discard/foo &&
26 p4 submit -d "initial revision"
30 test_expect_success 'check the repo was created correctly' '
31 test_when_finished cleanup_git &&
32 git p4 clone --dest="$git" //depot/...@all &&
34 cd "$git" &&
35 test_path_is_file wanted/foo &&
36 test_path_is_file discard/foo
40 test_expect_success 'clone, excluding part of repo' '
41 test_when_finished cleanup_git &&
42 git p4 clone -//depot/discard/... --dest="$git" //depot/...@all &&
44 cd "$git" &&
45 test_path_is_file wanted/foo &&
46 test_path_is_missing discard/foo
50 test_expect_success 'clone, then sync with exclude' '
51 test_when_finished cleanup_git &&
52 git p4 clone -//depot/discard/... --dest="$git" //depot/...@all &&
54 cd "$cli" &&
55 p4 edit wanted/foo discard/foo &&
56 date >>wanted/foo &&
57 date >>discard/foo &&
58 p4 submit -d "updating" &&
60 cd "$git" &&
61 git p4 sync -//depot/discard/... &&
62 test_path_is_file wanted/foo &&
63 test_path_is_missing discard/foo
67 test_expect_success 'kill p4d' '
68 kill_p4d
71 test_done