3 test_description
='git p4 options'
7 test_expect_success
'start p4d' '
11 test_expect_success
'init depot' '
16 p4 submit -d "change 1" &&
19 p4 submit -d "change 2" &&
22 p4 submit -d "change 3"
26 test_expect_success
'clone no --git-dir' '
27 test_must_fail git p4 clone --git-dir=xx //depot
30 test_expect_success
'clone --branch' '
31 git p4 clone --branch=refs/remotes/p4/sb --dest="$git" //depot &&
32 test_when_finished cleanup_git &&
35 git ls-files >files &&
36 test_line_count = 0 files &&
37 test_path_is_file .git/refs/remotes/p4/sb
41 test_expect_success
'clone --changesfile' '
42 test_when_finished "rm cf" &&
43 printf "1\n3\n" >cf &&
44 git p4 clone --changesfile="$TRASH_DIRECTORY/cf" --dest="$git" //depot &&
45 test_when_finished cleanup_git &&
48 git log --oneline p4/master >lines &&
49 test_line_count = 2 lines
50 test_path_is_file file1 &&
51 test_path_is_missing file2 &&
52 test_path_is_file file3
56 test_expect_success
'clone --changesfile, @all' '
57 test_when_finished "rm cf" &&
58 printf "1\n3\n" >cf &&
59 test_must_fail git p4 clone --changesfile="$TRASH_DIRECTORY/cf" --dest="$git" //depot@all
62 # imports both master and p4/master in refs/heads
63 # requires --import-local on sync to find p4 refs/heads
64 # does not update master on sync, just p4/master
65 test_expect_success
'clone/sync --import-local' '
66 git p4 clone --import-local --dest="$git" //depot@1,2 &&
67 test_when_finished cleanup_git &&
70 git log --oneline refs/heads/master >lines &&
71 test_line_count = 2 lines &&
72 git log --oneline refs/heads/p4/master >lines &&
73 test_line_count = 2 lines &&
74 test_must_fail git p4 sync &&
76 git p4 sync --import-local &&
77 git log --oneline refs/heads/master >lines &&
78 test_line_count = 2 lines &&
79 git log --oneline refs/heads/p4/master >lines &&
80 test_line_count = 3 lines
84 test_expect_success
'clone --max-changes' '
85 git p4 clone --dest="$git" --max-changes 2 //depot@all &&
86 test_when_finished cleanup_git &&
89 git log --oneline refs/heads/master >lines &&
90 test_line_count = 2 lines
94 test_expect_success
'clone --keep-path' '
98 echo f4 >sub/dir/f4 &&
100 p4 submit -d "change 4"
102 git p4 clone --dest="$git" --keep-path //depot/sub/dir@all &&
103 test_when_finished cleanup_git &&
106 test_path_is_missing f4 &&
107 test_path_is_file sub/dir/f4
110 git p4 clone --dest="$git" //depot/sub/dir@all &&
113 test_path_is_file f4 &&
114 test_path_is_missing sub/dir/f4
118 # clone --use-client-spec must still specify a depot path
119 # if given, it should rearrange files according to client spec
120 # when it has view lines that match the depot path
121 # XXX: should clone/sync just use the client spec exactly, rather
122 # than needing depot paths?
123 test_expect_success
'clone --use-client-spec' '
127 test_must_fail git p4 clone --dest="$git" --use-client-spec
129 cli2=$(test-path-utils real_path "$TRASH_DIRECTORY/cli2") &&
131 test_when_finished "rmdir \"$cli2\"" &&
138 View: //depot/sub/... //client2/bus/...
142 test_when_finished cleanup_git &&
143 git p4 clone --dest="$git" --use-client-spec //depot/... &&
146 test_path_is_file bus/dir/f4 &&
147 test_path_is_missing file1
151 # same thing again, this time with variable instead of option
155 git config git-p4.useClientSpec true &&
156 git p4 sync //depot/... &&
157 git checkout -b master p4/master &&
158 test_path_is_file bus/dir/f4 &&
159 test_path_is_missing file1
163 test_expect_success
'kill p4d' '