1
1
#! /bin/sh
2
2
3
- test_description=' git- p4 tests'
3
+ test_description=' git p4 tests'
4
4
5
5
. ./lib-git-p4.sh
6
6
@@ -20,8 +20,8 @@ test_expect_success 'add p4 files' '
20
20
)
21
21
'
22
22
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 &&
25
25
test_when_finished cleanup_git &&
26
26
(
27
27
cd "$git" &&
@@ -30,8 +30,8 @@ test_expect_success 'basic git-p4 clone' '
30
30
)
31
31
'
32
32
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 &&
35
35
test_when_finished cleanup_git &&
36
36
(
37
37
cd "$git" &&
@@ -40,26 +40,26 @@ test_expect_success 'git-p4 clone @all' '
40
40
)
41
41
'
42
42
43
- test_expect_success ' git- p4 sync uninitialized repo' '
43
+ test_expect_success ' git p4 sync uninitialized repo' '
44
44
test_create_repo "$git" &&
45
45
test_when_finished cleanup_git &&
46
46
(
47
47
cd "$git" &&
48
- test_must_fail "$GITP4" sync
48
+ test_must_fail git p4 sync
49
49
)
50
50
'
51
51
52
52
#
53
53
# Create a git repo by hand. Add a commit so that HEAD is valid.
54
54
# Test imports a new p4 repository into a new git branch.
55
55
#
56
- test_expect_success ' git- p4 sync new branch' '
56
+ test_expect_success ' git p4 sync new branch' '
57
57
test_create_repo "$git" &&
58
58
test_when_finished cleanup_git &&
59
59
(
60
60
cd "$git" &&
61
61
test_commit head &&
62
- "$GITP4" sync --branch=refs/remotes/p4/depot //depot@all &&
62
+ git p4 sync --branch=refs/remotes/p4/depot //depot@all &&
63
63
git log --oneline p4/depot >lines &&
64
64
test_line_count = 2 lines
65
65
)
@@ -76,7 +76,7 @@ test_expect_success 'clone two dirs' '
76
76
p4 add sub2/f2 &&
77
77
p4 submit -d "sub2/f2"
78
78
) &&
79
- "$GITP4" clone --dest="$git" //depot/sub1 //depot/sub2 &&
79
+ git p4 clone --dest="$git" //depot/sub1 //depot/sub2 &&
80
80
test_when_finished cleanup_git &&
81
81
(
82
82
cd "$git" &&
@@ -94,7 +94,7 @@ test_expect_success 'clone two dirs, @all' '
94
94
p4 add sub1/f3 &&
95
95
p4 submit -d "sub1/f3"
96
96
) &&
97
- "$GITP4" clone --dest="$git" //depot/sub1@all //depot/sub2@all &&
97
+ git p4 clone --dest="$git" //depot/sub1@all //depot/sub2@all &&
98
98
test_when_finished cleanup_git &&
99
99
(
100
100
cd "$git" &&
@@ -112,7 +112,7 @@ test_expect_success 'clone two dirs, @all, conflicting files' '
112
112
p4 add sub2/f3 &&
113
113
p4 submit -d "sub2/f3"
114
114
) &&
115
- "$GITP4" clone --dest="$git" //depot/sub1@all //depot/sub2@all &&
115
+ git p4 clone --dest="$git" //depot/sub1@all //depot/sub2@all &&
116
116
test_when_finished cleanup_git &&
117
117
(
118
118
cd "$git" &&
@@ -134,7 +134,7 @@ test_expect_success 'exit when p4 fails to produce marshaled output' '
134
134
exit 1
135
135
EOF
136
136
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=$? &&
138
138
test $retval -eq 1 &&
139
139
test_must_fail grep -q Traceback errs
140
140
'
@@ -151,8 +151,8 @@ test_expect_success 'add p4 files with wildcards in the names' '
151
151
)
152
152
'
153
153
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 &&
156
156
test_when_finished cleanup_git &&
157
157
(
158
158
cd "$git" &&
@@ -164,7 +164,7 @@ test_expect_success 'wildcard files git-p4 clone' '
164
164
'
165
165
166
166
test_expect_success ' clone bare' '
167
- "$GITP4" clone --dest="$git" --bare //depot &&
167
+ git p4 clone --dest="$git" --bare //depot &&
168
168
test_when_finished cleanup_git &&
169
169
(
170
170
cd "$git" &&
@@ -209,7 +209,7 @@ test_expect_success 'preserve users' '
209
209
p4_add_user alice Alice &&
210
210
p4_add_user bob Bob &&
211
211
p4_grant_admin alice &&
212
- "$GITP4" clone --dest="$git" //depot &&
212
+ git p4 clone --dest="$git" //depot &&
213
213
test_when_finished cleanup_git &&
214
214
(
215
215
cd "$git" &&
@@ -218,7 +218,7 @@ test_expect_success 'preserve users' '
218
218
git commit --author "Alice <alice@localhost>" -m "a change by alice" file1 &&
219
219
git commit --author "Bob <bob@localhost>" -m "a change by bob" file2 &&
220
220
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 &&
222
222
p4_check_commit_author file1 alice &&
223
223
p4_check_commit_author file2 bob
224
224
)
@@ -227,7 +227,7 @@ test_expect_success 'preserve users' '
227
227
# Test username support, submitting as bob, who lacks admin rights. Should
228
228
# not submit change to p4 (git diff should show deltas).
229
229
test_expect_success ' refuse to preserve users without perms' '
230
- "$GITP4" clone --dest="$git" //depot &&
230
+ git p4 clone --dest="$git" //depot &&
231
231
test_when_finished cleanup_git &&
232
232
(
233
233
cd "$git" &&
@@ -236,14 +236,14 @@ test_expect_success 'refuse to preserve users without perms' '
236
236
git commit --author "Alice <alice@localhost>" -m "perms: a change by alice" file1 &&
237
237
P4EDITOR=touch P4USER=bob P4PASSWD=secret &&
238
238
export P4EDITOR P4USER P4PASSWD &&
239
- test_must_fail "$GITP4" commit --preserve-user &&
239
+ test_must_fail git p4 commit --preserve-user &&
240
240
! git diff --exit-code HEAD..p4/master
241
241
)
242
242
'
243
243
244
244
# What happens with unknown author? Without allowMissingP4Users it should fail.
245
245
test_expect_success ' preserve user where author is unknown to p4' '
246
- "$GITP4" clone --dest="$git" //depot &&
246
+ git p4 clone --dest="$git" //depot &&
247
247
test_when_finished cleanup_git &&
248
248
(
249
249
cd "$git" &&
@@ -254,24 +254,24 @@ test_expect_success 'preserve user where author is unknown to p4' '
254
254
git commit --author "Charlie <charlie@localhost>" -m "preserve: a change by charlie" file1 &&
255
255
P4EDITOR=touch P4USER=alice P4PASSWD=secret &&
256
256
export P4EDITOR P4USER P4PASSWD &&
257
- test_must_fail "$GITP4" commit --preserve-user &&
257
+ test_must_fail git p4 commit --preserve-user &&
258
258
! git diff --exit-code HEAD..p4/master &&
259
259
260
260
echo "$0: repeat with allowMissingP4Users enabled" &&
261
261
git config git-p4.allowMissingP4Users true &&
262
262
git config git-p4.preserveUser true &&
263
- "$GITP4" commit &&
263
+ git p4 commit &&
264
264
git diff --exit-code HEAD..p4/master &&
265
265
p4_check_commit_author file1 alice
266
266
)
267
267
'
268
268
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
270
270
# changes that are not all ours.
271
271
# Test: user in p4 and user unknown to p4.
272
272
# Test: warning disabled and user is the same.
273
273
test_expect_success ' not preserving user with mixed authorship' '
274
- "$GITP4" clone --dest="$git" //depot &&
274
+ git p4 clone --dest="$git" //depot &&
275
275
test_when_finished cleanup_git &&
276
276
(
277
277
cd "$git" &&
@@ -281,20 +281,20 @@ test_expect_success 'not preserving user with mixed authorship' '
281
281
make_change_by_user usernamefile3 Derek derek@localhost &&
282
282
P4EDITOR=cat P4USER=alice P4PASSWD=secret &&
283
283
export P4EDITOR P4USER P4PASSWD &&
284
- "$GITP4" commit |\
284
+ git p4 commit |\
285
285
grep "git author derek@localhost does not match" &&
286
286
287
287
make_change_by_user usernamefile3 Charlie charlie@localhost &&
288
- "$GITP4" commit |\
288
+ git p4 commit |\
289
289
grep "git author charlie@localhost does not match" &&
290
290
291
291
make_change_by_user usernamefile3 alice alice@localhost &&
292
- "$GITP4" commit |\
292
+ git p4 commit |\
293
293
test_must_fail grep "git author.*does not match" &&
294
294
295
295
git config git-p4.skipUserNameCheck true &&
296
296
make_change_by_user usernamefile3 Charlie charlie@localhost &&
297
- "$GITP4" commit |\
297
+ git p4 commit |\
298
298
test_must_fail grep "git author.*does not match" &&
299
299
300
300
p4_check_commit_author usernamefile3 alice
@@ -313,7 +313,7 @@ test_expect_success 'initial import time from top change time' '
313
313
p4change=$(p4 -G changes -m 1 //depot/... | marshal_dump change) &&
314
314
p4time=$(p4 -G changes -m 1 //depot/... | marshal_dump time) &&
315
315
sleep 3 &&
316
- "$GITP4" clone --dest="$git" //depot &&
316
+ git p4 clone --dest="$git" //depot &&
317
317
test_when_finished cleanup_git &&
318
318
(
319
319
cd "$git" &&
@@ -331,7 +331,7 @@ test_expect_success 'initial import time from top change time' '
331
331
# Repeat, this time with a smaller threshold and confirm that the rename is
332
332
# detected in P4.
333
333
test_expect_success ' detect renames' '
334
- "$GITP4" clone --dest="$git" //depot@all &&
334
+ git p4 clone --dest="$git" //depot@all &&
335
335
test_when_finished cleanup_git &&
336
336
(
337
337
cd "$git" &&
@@ -340,15 +340,15 @@ test_expect_success 'detect renames' '
340
340
git mv file1 file4 &&
341
341
git commit -a -m "Rename file1 to file4" &&
342
342
git diff-tree -r -M HEAD &&
343
- "$GITP4" submit &&
343
+ git p4 submit &&
344
344
p4 filelog //depot/file4 &&
345
345
p4 filelog //depot/file4 | test_must_fail grep -q "branch from" &&
346
346
347
347
git mv file4 file5 &&
348
348
git commit -a -m "Rename file4 to file5" &&
349
349
git diff-tree -r -M HEAD &&
350
350
git config git-p4.detectRenames true &&
351
- "$GITP4" submit &&
351
+ git p4 submit &&
352
352
p4 filelog //depot/file5 &&
353
353
p4 filelog //depot/file5 | grep -q "branch from //depot/file4" &&
354
354
@@ -360,7 +360,7 @@ test_expect_success 'detect renames' '
360
360
level=$(git diff-tree -r -M HEAD | sed 1d | cut -f1 | cut -d" " -f5 | sed "s/R0*//") &&
361
361
test -n "$level" && test "$level" -gt 0 && test "$level" -lt 98 &&
362
362
git config git-p4.detectRenames $(($level + 2)) &&
363
- "$GITP4" submit &&
363
+ git p4 submit &&
364
364
p4 filelog //depot/file6 &&
365
365
p4 filelog //depot/file6 | test_must_fail grep -q "branch from" &&
366
366
@@ -372,7 +372,7 @@ test_expect_success 'detect renames' '
372
372
level=$(git diff-tree -r -M HEAD | sed 1d | cut -f1 | cut -d" " -f5 | sed "s/R0*//") &&
373
373
test -n "$level" && test "$level" -gt 2 && test "$level" -lt 100 &&
374
374
git config git-p4.detectRenames $(($level - 2)) &&
375
- "$GITP4" submit &&
375
+ git p4 submit &&
376
376
p4 filelog //depot/file7 &&
377
377
p4 filelog //depot/file7 | grep -q "branch from //depot/file6"
378
378
)
@@ -390,7 +390,7 @@ test_expect_success 'detect renames' '
390
390
# Modify and copy a file, configure a smaller threshold in detectCopies and
391
391
# confirm that copy is detected in P4.
392
392
test_expect_success ' detect copies' '
393
- "$GITP4" clone --dest="$git" //depot@all &&
393
+ git p4 clone --dest="$git" //depot@all &&
394
394
test_when_finished cleanup_git &&
395
395
(
396
396
cd "$git" &&
@@ -400,7 +400,7 @@ test_expect_success 'detect copies' '
400
400
git add file8 &&
401
401
git commit -a -m "Copy file2 to file8" &&
402
402
git diff-tree -r -C HEAD &&
403
- "$GITP4" submit &&
403
+ git p4 submit &&
404
404
p4 filelog //depot/file8 &&
405
405
p4 filelog //depot/file8 | test_must_fail grep -q "branch from" &&
406
406
@@ -409,7 +409,7 @@ test_expect_success 'detect copies' '
409
409
git commit -a -m "Copy file2 to file9" &&
410
410
git diff-tree -r -C HEAD &&
411
411
git config git-p4.detectCopies true &&
412
- "$GITP4" submit &&
412
+ git p4 submit &&
413
413
p4 filelog //depot/file9 &&
414
414
p4 filelog //depot/file9 | test_must_fail grep -q "branch from" &&
415
415
@@ -418,7 +418,7 @@ test_expect_success 'detect copies' '
418
418
git add file2 file10 &&
419
419
git commit -a -m "Modify and copy file2 to file10" &&
420
420
git diff-tree -r -C HEAD &&
421
- "$GITP4" submit &&
421
+ git p4 submit &&
422
422
p4 filelog //depot/file10 &&
423
423
p4 filelog //depot/file10 | grep -q "branch from //depot/file" &&
424
424
@@ -429,7 +429,7 @@ test_expect_success 'detect copies' '
429
429
src=$(git diff-tree -r -C --find-copies-harder HEAD | sed 1d | cut -f2) &&
430
430
test "$src" = file10 &&
431
431
git config git-p4.detectCopiesHarder true &&
432
- "$GITP4" submit &&
432
+ git p4 submit &&
433
433
p4 filelog //depot/file11 &&
434
434
p4 filelog //depot/file11 | grep -q "branch from //depot/file" &&
435
435
@@ -443,7 +443,7 @@ test_expect_success 'detect copies' '
443
443
src=$(git diff-tree -r -C --find-copies-harder HEAD | sed 1d | cut -f2) &&
444
444
test "$src" = file10 &&
445
445
git config git-p4.detectCopies $(($level + 2)) &&
446
- "$GITP4" submit &&
446
+ git p4 submit &&
447
447
p4 filelog //depot/file12 &&
448
448
p4 filelog //depot/file12 | test_must_fail grep -q "branch from" &&
449
449
@@ -457,7 +457,7 @@ test_expect_success 'detect copies' '
457
457
src=$(git diff-tree -r -C --find-copies-harder HEAD | sed 1d | cut -f2) &&
458
458
test "$src" = file10 &&
459
459
git config git-p4.detectCopies $(($level - 2)) &&
460
- "$GITP4" submit &&
460
+ git p4 submit &&
461
461
p4 filelog //depot/file13 &&
462
462
p4 filelog //depot/file13 | grep -q "branch from //depot/file"
463
463
)
0 commit comments