11#! /bin/sh
22
3- test_description=' git- p4 tests'
3+ test_description=' git p4 tests'
44
55. ./lib-git-p4.sh
66
@@ -20,8 +20,8 @@ test_expect_success 'add p4 files' '
2020 )
2121'
2222
23- test_expect_success ' basic git- p4 clone' '
24- "$GITP4" clone --dest="$git" //depot &&
23+ test_expect_success ' basic git p4 clone' '
24+ git p4 clone --dest="$git" //depot &&
2525 test_when_finished cleanup_git &&
2626 (
2727 cd "$git" &&
@@ -30,8 +30,8 @@ test_expect_success 'basic git-p4 clone' '
3030 )
3131'
3232
33- test_expect_success ' git- p4 clone @all' '
34- "$GITP4" clone --dest="$git" //depot@all &&
33+ test_expect_success ' git p4 clone @all' '
34+ git p4 clone --dest="$git" //depot@all &&
3535 test_when_finished cleanup_git &&
3636 (
3737 cd "$git" &&
@@ -40,26 +40,26 @@ test_expect_success 'git-p4 clone @all' '
4040 )
4141'
4242
43- test_expect_success ' git- p4 sync uninitialized repo' '
43+ test_expect_success ' git p4 sync uninitialized repo' '
4444 test_create_repo "$git" &&
4545 test_when_finished cleanup_git &&
4646 (
4747 cd "$git" &&
48- test_must_fail "$GITP4" sync
48+ test_must_fail git p4 sync
4949 )
5050'
5151
5252#
5353# Create a git repo by hand. Add a commit so that HEAD is valid.
5454# Test imports a new p4 repository into a new git branch.
5555#
56- test_expect_success ' git- p4 sync new branch' '
56+ test_expect_success ' git p4 sync new branch' '
5757 test_create_repo "$git" &&
5858 test_when_finished cleanup_git &&
5959 (
6060 cd "$git" &&
6161 test_commit head &&
62- "$GITP4" sync --branch=refs/remotes/p4/depot //depot@all &&
62+ git p4 sync --branch=refs/remotes/p4/depot //depot@all &&
6363 git log --oneline p4/depot >lines &&
6464 test_line_count = 2 lines
6565 )
@@ -76,7 +76,7 @@ test_expect_success 'clone two dirs' '
7676 p4 add sub2/f2 &&
7777 p4 submit -d "sub2/f2"
7878 ) &&
79- "$GITP4" clone --dest="$git" //depot/sub1 //depot/sub2 &&
79+ git p4 clone --dest="$git" //depot/sub1 //depot/sub2 &&
8080 test_when_finished cleanup_git &&
8181 (
8282 cd "$git" &&
@@ -94,7 +94,7 @@ test_expect_success 'clone two dirs, @all' '
9494 p4 add sub1/f3 &&
9595 p4 submit -d "sub1/f3"
9696 ) &&
97- "$GITP4" clone --dest="$git" //depot/sub1@all //depot/sub2@all &&
97+ git p4 clone --dest="$git" //depot/sub1@all //depot/sub2@all &&
9898 test_when_finished cleanup_git &&
9999 (
100100 cd "$git" &&
@@ -112,7 +112,7 @@ test_expect_success 'clone two dirs, @all, conflicting files' '
112112 p4 add sub2/f3 &&
113113 p4 submit -d "sub2/f3"
114114 ) &&
115- "$GITP4" clone --dest="$git" //depot/sub1@all //depot/sub2@all &&
115+ git p4 clone --dest="$git" //depot/sub1@all //depot/sub2@all &&
116116 test_when_finished cleanup_git &&
117117 (
118118 cd "$git" &&
@@ -134,7 +134,7 @@ test_expect_success 'exit when p4 fails to produce marshaled output' '
134134 exit 1
135135 EOF
136136 chmod 755 "$badp4dir"/p4 &&
137- PATH="$badp4dir:$PATH" "$GITP4" clone --dest="$git" //depot >errs 2>&1 ; retval=$? &&
137+ PATH="$badp4dir:$PATH" git p4 clone --dest="$git" //depot >errs 2>&1 ; retval=$? &&
138138 test $retval -eq 1 &&
139139 test_must_fail grep -q Traceback errs
140140'
@@ -151,8 +151,8 @@ test_expect_success 'add p4 files with wildcards in the names' '
151151 )
152152'
153153
154- test_expect_success ' wildcard files git- p4 clone' '
155- "$GITP4" clone --dest="$git" //depot &&
154+ test_expect_success ' wildcard files git p4 clone' '
155+ git p4 clone --dest="$git" //depot &&
156156 test_when_finished cleanup_git &&
157157 (
158158 cd "$git" &&
@@ -164,7 +164,7 @@ test_expect_success 'wildcard files git-p4 clone' '
164164'
165165
166166test_expect_success ' clone bare' '
167- "$GITP4" clone --dest="$git" --bare //depot &&
167+ git p4 clone --dest="$git" --bare //depot &&
168168 test_when_finished cleanup_git &&
169169 (
170170 cd "$git" &&
@@ -209,7 +209,7 @@ test_expect_success 'preserve users' '
209209 p4_add_user alice Alice &&
210210 p4_add_user bob Bob &&
211211 p4_grant_admin alice &&
212- "$GITP4" clone --dest="$git" //depot &&
212+ git p4 clone --dest="$git" //depot &&
213213 test_when_finished cleanup_git &&
214214 (
215215 cd "$git" &&
@@ -218,7 +218,7 @@ test_expect_success 'preserve users' '
218218 git commit --author "Alice <alice@localhost>" -m "a change by alice" file1 &&
219219 git commit --author "Bob <bob@localhost>" -m "a change by bob" file2 &&
220220 git config git-p4.skipSubmitEditCheck true &&
221- P4EDITOR=touch P4USER=alice P4PASSWD=secret "$GITP4" commit --preserve-user &&
221+ P4EDITOR=touch P4USER=alice P4PASSWD=secret git p4 commit --preserve-user &&
222222 p4_check_commit_author file1 alice &&
223223 p4_check_commit_author file2 bob
224224 )
@@ -227,7 +227,7 @@ test_expect_success 'preserve users' '
227227# Test username support, submitting as bob, who lacks admin rights. Should
228228# not submit change to p4 (git diff should show deltas).
229229test_expect_success ' refuse to preserve users without perms' '
230- "$GITP4" clone --dest="$git" //depot &&
230+ git p4 clone --dest="$git" //depot &&
231231 test_when_finished cleanup_git &&
232232 (
233233 cd "$git" &&
@@ -236,14 +236,14 @@ test_expect_success 'refuse to preserve users without perms' '
236236 git commit --author "Alice <alice@localhost>" -m "perms: a change by alice" file1 &&
237237 P4EDITOR=touch P4USER=bob P4PASSWD=secret &&
238238 export P4EDITOR P4USER P4PASSWD &&
239- test_must_fail "$GITP4" commit --preserve-user &&
239+ test_must_fail git p4 commit --preserve-user &&
240240 ! git diff --exit-code HEAD..p4/master
241241 )
242242'
243243
244244# What happens with unknown author? Without allowMissingP4Users it should fail.
245245test_expect_success ' preserve user where author is unknown to p4' '
246- "$GITP4" clone --dest="$git" //depot &&
246+ git p4 clone --dest="$git" //depot &&
247247 test_when_finished cleanup_git &&
248248 (
249249 cd "$git" &&
@@ -254,24 +254,24 @@ test_expect_success 'preserve user where author is unknown to p4' '
254254 git commit --author "Charlie <charlie@localhost>" -m "preserve: a change by charlie" file1 &&
255255 P4EDITOR=touch P4USER=alice P4PASSWD=secret &&
256256 export P4EDITOR P4USER P4PASSWD &&
257- test_must_fail "$GITP4" commit --preserve-user &&
257+ test_must_fail git p4 commit --preserve-user &&
258258 ! git diff --exit-code HEAD..p4/master &&
259259
260260 echo "$0: repeat with allowMissingP4Users enabled" &&
261261 git config git-p4.allowMissingP4Users true &&
262262 git config git-p4.preserveUser true &&
263- "$GITP4" commit &&
263+ git p4 commit &&
264264 git diff --exit-code HEAD..p4/master &&
265265 p4_check_commit_author file1 alice
266266 )
267267'
268268
269- # If we're *not* using --preserve-user, git- p4 should warn if we're submitting
269+ # If we're *not* using --preserve-user, git p4 should warn if we're submitting
270270# changes that are not all ours.
271271# Test: user in p4 and user unknown to p4.
272272# Test: warning disabled and user is the same.
273273test_expect_success ' not preserving user with mixed authorship' '
274- "$GITP4" clone --dest="$git" //depot &&
274+ git p4 clone --dest="$git" //depot &&
275275 test_when_finished cleanup_git &&
276276 (
277277 cd "$git" &&
@@ -281,20 +281,20 @@ test_expect_success 'not preserving user with mixed authorship' '
281281 make_change_by_user usernamefile3 Derek derek@localhost &&
282282 P4EDITOR=cat P4USER=alice P4PASSWD=secret &&
283283 export P4EDITOR P4USER P4PASSWD &&
284- "$GITP4" commit |\
284+ git p4 commit |\
285285 grep "git author derek@localhost does not match" &&
286286
287287 make_change_by_user usernamefile3 Charlie charlie@localhost &&
288- "$GITP4" commit |\
288+ git p4 commit |\
289289 grep "git author charlie@localhost does not match" &&
290290
291291 make_change_by_user usernamefile3 alice alice@localhost &&
292- "$GITP4" commit |\
292+ git p4 commit |\
293293 test_must_fail grep "git author.*does not match" &&
294294
295295 git config git-p4.skipUserNameCheck true &&
296296 make_change_by_user usernamefile3 Charlie charlie@localhost &&
297- "$GITP4" commit |\
297+ git p4 commit |\
298298 test_must_fail grep "git author.*does not match" &&
299299
300300 p4_check_commit_author usernamefile3 alice
@@ -313,7 +313,7 @@ test_expect_success 'initial import time from top change time' '
313313 p4change=$(p4 -G changes -m 1 //depot/... | marshal_dump change) &&
314314 p4time=$(p4 -G changes -m 1 //depot/... | marshal_dump time) &&
315315 sleep 3 &&
316- "$GITP4" clone --dest="$git" //depot &&
316+ git p4 clone --dest="$git" //depot &&
317317 test_when_finished cleanup_git &&
318318 (
319319 cd "$git" &&
@@ -331,7 +331,7 @@ test_expect_success 'initial import time from top change time' '
331331# Repeat, this time with a smaller threshold and confirm that the rename is
332332# detected in P4.
333333test_expect_success ' detect renames' '
334- "$GITP4" clone --dest="$git" //depot@all &&
334+ git p4 clone --dest="$git" //depot@all &&
335335 test_when_finished cleanup_git &&
336336 (
337337 cd "$git" &&
@@ -340,15 +340,15 @@ test_expect_success 'detect renames' '
340340 git mv file1 file4 &&
341341 git commit -a -m "Rename file1 to file4" &&
342342 git diff-tree -r -M HEAD &&
343- "$GITP4" submit &&
343+ git p4 submit &&
344344 p4 filelog //depot/file4 &&
345345 p4 filelog //depot/file4 | test_must_fail grep -q "branch from" &&
346346
347347 git mv file4 file5 &&
348348 git commit -a -m "Rename file4 to file5" &&
349349 git diff-tree -r -M HEAD &&
350350 git config git-p4.detectRenames true &&
351- "$GITP4" submit &&
351+ git p4 submit &&
352352 p4 filelog //depot/file5 &&
353353 p4 filelog //depot/file5 | grep -q "branch from //depot/file4" &&
354354
@@ -360,7 +360,7 @@ test_expect_success 'detect renames' '
360360 level=$(git diff-tree -r -M HEAD | sed 1d | cut -f1 | cut -d" " -f5 | sed "s/R0*//") &&
361361 test -n "$level" && test "$level" -gt 0 && test "$level" -lt 98 &&
362362 git config git-p4.detectRenames $(($level + 2)) &&
363- "$GITP4" submit &&
363+ git p4 submit &&
364364 p4 filelog //depot/file6 &&
365365 p4 filelog //depot/file6 | test_must_fail grep -q "branch from" &&
366366
@@ -372,7 +372,7 @@ test_expect_success 'detect renames' '
372372 level=$(git diff-tree -r -M HEAD | sed 1d | cut -f1 | cut -d" " -f5 | sed "s/R0*//") &&
373373 test -n "$level" && test "$level" -gt 2 && test "$level" -lt 100 &&
374374 git config git-p4.detectRenames $(($level - 2)) &&
375- "$GITP4" submit &&
375+ git p4 submit &&
376376 p4 filelog //depot/file7 &&
377377 p4 filelog //depot/file7 | grep -q "branch from //depot/file6"
378378 )
@@ -390,7 +390,7 @@ test_expect_success 'detect renames' '
390390# Modify and copy a file, configure a smaller threshold in detectCopies and
391391# confirm that copy is detected in P4.
392392test_expect_success ' detect copies' '
393- "$GITP4" clone --dest="$git" //depot@all &&
393+ git p4 clone --dest="$git" //depot@all &&
394394 test_when_finished cleanup_git &&
395395 (
396396 cd "$git" &&
@@ -400,7 +400,7 @@ test_expect_success 'detect copies' '
400400 git add file8 &&
401401 git commit -a -m "Copy file2 to file8" &&
402402 git diff-tree -r -C HEAD &&
403- "$GITP4" submit &&
403+ git p4 submit &&
404404 p4 filelog //depot/file8 &&
405405 p4 filelog //depot/file8 | test_must_fail grep -q "branch from" &&
406406
@@ -409,7 +409,7 @@ test_expect_success 'detect copies' '
409409 git commit -a -m "Copy file2 to file9" &&
410410 git diff-tree -r -C HEAD &&
411411 git config git-p4.detectCopies true &&
412- "$GITP4" submit &&
412+ git p4 submit &&
413413 p4 filelog //depot/file9 &&
414414 p4 filelog //depot/file9 | test_must_fail grep -q "branch from" &&
415415
@@ -418,7 +418,7 @@ test_expect_success 'detect copies' '
418418 git add file2 file10 &&
419419 git commit -a -m "Modify and copy file2 to file10" &&
420420 git diff-tree -r -C HEAD &&
421- "$GITP4" submit &&
421+ git p4 submit &&
422422 p4 filelog //depot/file10 &&
423423 p4 filelog //depot/file10 | grep -q "branch from //depot/file" &&
424424
@@ -429,7 +429,7 @@ test_expect_success 'detect copies' '
429429 src=$(git diff-tree -r -C --find-copies-harder HEAD | sed 1d | cut -f2) &&
430430 test "$src" = file10 &&
431431 git config git-p4.detectCopiesHarder true &&
432- "$GITP4" submit &&
432+ git p4 submit &&
433433 p4 filelog //depot/file11 &&
434434 p4 filelog //depot/file11 | grep -q "branch from //depot/file" &&
435435
@@ -443,7 +443,7 @@ test_expect_success 'detect copies' '
443443 src=$(git diff-tree -r -C --find-copies-harder HEAD | sed 1d | cut -f2) &&
444444 test "$src" = file10 &&
445445 git config git-p4.detectCopies $(($level + 2)) &&
446- "$GITP4" submit &&
446+ git p4 submit &&
447447 p4 filelog //depot/file12 &&
448448 p4 filelog //depot/file12 | test_must_fail grep -q "branch from" &&
449449
@@ -457,7 +457,7 @@ test_expect_success 'detect copies' '
457457 src=$(git diff-tree -r -C --find-copies-harder HEAD | sed 1d | cut -f2) &&
458458 test "$src" = file10 &&
459459 git config git-p4.detectCopies $(($level - 2)) &&
460- "$GITP4" submit &&
460+ git p4 submit &&
461461 p4 filelog //depot/file13 &&
462462 p4 filelog //depot/file13 | grep -q "branch from //depot/file"
463463 )
0 commit comments