]> git.ipfire.org Git - thirdparty/git.git/blame - t/t9817-git-p4-exclude.sh
path.c: don't call the match function without value in trie_find()
[thirdparty/git.git] / t / t9817-git-p4-exclude.sh
CommitLineData
51334bb0
LD
1#!/bin/sh
2
3test_description='git p4 tests for excluded paths during clone and sync'
4
5. ./lib-git-p4.sh
6
7test_expect_success 'start p4d' '
8 start_p4d
9'
10
11# Create a repo with the structure:
12#
13# //depot/wanted/foo
14# //depot/discard/foo
15#
16# Check that we can exclude a subdirectory with both
17# clone and sync operations.
18
19test_expect_success 'create exclude repo' '
20 (
21 cd "$cli" &&
22 mkdir -p wanted discard &&
23 echo wanted >wanted/foo &&
24 echo discard >discard/foo &&
d6045201
AM
25 echo discard_file >discard_file &&
26 echo discard_file_not >discard_file_not &&
27 p4 add wanted/foo discard/foo discard_file discard_file_not &&
51334bb0
LD
28 p4 submit -d "initial revision"
29 )
30'
31
32test_expect_success 'check the repo was created correctly' '
33 test_when_finished cleanup_git &&
34 git p4 clone --dest="$git" //depot/...@all &&
35 (
36 cd "$git" &&
37 test_path_is_file wanted/foo &&
d6045201
AM
38 test_path_is_file discard/foo &&
39 test_path_is_file discard_file &&
40 test_path_is_file discard_file_not
51334bb0
LD
41 )
42'
43
44test_expect_success 'clone, excluding part of repo' '
45 test_when_finished cleanup_git &&
46 git p4 clone -//depot/discard/... --dest="$git" //depot/...@all &&
47 (
48 cd "$git" &&
49 test_path_is_file wanted/foo &&
d6045201
AM
50 test_path_is_missing discard/foo &&
51 test_path_is_file discard_file &&
52 test_path_is_file discard_file_not
53 )
54'
55
a2bee10a 56test_expect_success 'clone, excluding single file, no trailing /' '
d6045201
AM
57 test_when_finished cleanup_git &&
58 git p4 clone -//depot/discard_file --dest="$git" //depot/...@all &&
59 (
60 cd "$git" &&
61 test_path_is_file wanted/foo &&
62 test_path_is_file discard/foo &&
63 test_path_is_missing discard_file &&
64 test_path_is_file discard_file_not
51334bb0
LD
65 )
66'
67
68test_expect_success 'clone, then sync with exclude' '
69 test_when_finished cleanup_git &&
70 git p4 clone -//depot/discard/... --dest="$git" //depot/...@all &&
71 (
72 cd "$cli" &&
d6045201 73 p4 edit wanted/foo discard/foo discard_file_not &&
51334bb0
LD
74 date >>wanted/foo &&
75 date >>discard/foo &&
d6045201 76 date >>discard_file_not &&
51334bb0
LD
77 p4 submit -d "updating" &&
78
79 cd "$git" &&
80 git p4 sync -//depot/discard/... &&
81 test_path_is_file wanted/foo &&
d6045201
AM
82 test_path_is_missing discard/foo &&
83 test_path_is_file discard_file &&
84 test_path_is_file discard_file_not
85 )
86'
87
a2bee10a 88test_expect_success 'clone, then sync with exclude, no trailing /' '
d6045201
AM
89 test_when_finished cleanup_git &&
90 git p4 clone -//depot/discard/... -//depot/discard_file --dest="$git" //depot/...@all &&
91 (
92 cd "$cli" &&
93 p4 edit wanted/foo discard/foo discard_file_not &&
94 date >>wanted/foo &&
95 date >>discard/foo &&
96 date >>discard_file_not &&
97 p4 submit -d "updating" &&
98
99 cd "$git" &&
100 git p4 sync -//depot/discard/... -//depot/discard_file &&
101 test_path_is_file wanted/foo &&
102 test_path_is_missing discard/foo &&
103 test_path_is_missing discard_file &&
104 test_path_is_file discard_file_not
51334bb0
LD
105 )
106'
107
51334bb0 108test_done