git-p4: add failing test for shelved CL update involving move/copy
Updating a shelved P4 changelist where one or more files have been moved or copied does not work. Add a test for this. The problem is that P4 requires a complete list of the files being changed, and move/copy only includes the _source_ in the case of updating a shelved changelist. This results in errors from Perforce such as: //depot/src - needs tofile //depot/dst Submit aborted -- fix problems then use 'p4 submit -c 1234' Signed-off-by: Luke Diamand <luke@diamand.org> Acked-by: Andrey Mazo <amazo@checkvideo.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Luke Diamand committed
Jan 18, 2019 at 09:36 UTC
7a10bb3a4cc6fb5165d880cfb0be3a2eff438c95
1 file changed
+54
-3
t/t9807-git-p4-submit.sh
+54
-3
@@ -500,6 +500,10 @@ test_expect_success 'submit --shelve' '
500
)
501
'
502
503
+last_shelve () {
504
+ p4 -G changes -s shelved -m 1 //depot/... | marshal_dump change
505
+}
506
+
507
make_shelved_cl() {
508
test_commit "$1" >/dev/null &&
509
git p4 submit --origin HEAD^ --shelve >/dev/null &&
@@ -533,12 +537,59 @@ test_expect_success 'submit --update-shelve' '
537
) &&
538
(
539
cd "$cli" &&
536
- change=$(p4 -G changes -s shelved -m 1 //depot/... | \
537
- marshal_dump change) &&
540
+ change=$(last_shelve) &&
541
p4 unshelve -c $change -s $change &&
542
grep -q updated-line shelf.t &&
543
p4 describe -S $change | grep added-file.t &&
541
- test_path_is_missing shelved-change-1.t
544
+ test_path_is_missing shelved-change-1.t &&
545
+ p4 revert ...
546
+ )
547
+'
548
+
549
+test_expect_failure 'update a shelve involving moved and copied files' '
550
+ test_when_finished cleanup_git &&
551
+ (
552
+ cd "$cli" &&
553
+ : >file_to_move &&
554
+ p4 add file_to_move &&
555
+ p4 submit -d "change1" &&
556
+ p4 edit file_to_move &&
557
+ echo change >>file_to_move &&
558
+ p4 submit -d "change2" &&
559
+ p4 opened
560
+ ) &&
561
+ git p4 clone --dest="$git" //depot &&
562
+ (
563
+ cd "$git" &&
564
+ git config git-p4.detectCopies true &&
565
+ git config git-p4.detectRenames true &&
566
+ git config git-p4.skipSubmitEdit true &&
567
+ mkdir moved &&
568
+ cp file_to_move copy_of_file &&
569
+ git add copy_of_file &&
570
+ git mv file_to_move moved/ &&
571
+ git commit -m "rename a file" &&
572
+ git p4 submit -M --shelve --origin HEAD^ &&
573
+ : >new_file &&
574
+ git add new_file &&
575
+ git commit --amend &&
576
+ git show --stat HEAD &&
577
+ change=$(last_shelve) &&
578
+ git p4 submit -M --update-shelve $change --commit HEAD
579
+ ) &&
580
+ (
581
+ cd "$cli" &&
582
+ change=$(last_shelve) &&
583
+ echo change=$change &&
584
+ p4 unshelve -s $change &&
585
+ p4 submit -d "Testing update-shelve" &&
586
+ test_path_is_file copy_of_file &&
587
+ test_path_is_file moved/file_to_move &&
588
+ test_path_is_missing file_to_move &&
589
+ test_path_is_file new_file &&
590
+ echo "unshelved and submitted change $change" &&
591
+ p4 changes moved/file_to_move | grep "Testing update-shelve" &&
592
+ p4 changes copy_of_file | grep "Testing update-shelve"
593
)
594
'
595