git-p4: handle update of moved/copied files when updating a shelve

Perforce requires a complete list of files being operated on. If git is updating an existing shelved changelist, then any files which are moved or copied were not being added to this list. 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 7a10946ab9dd4692fc99d219f0cd4bc3d5e16d63
2 files changed +3 -1
git-p4.py
+2
@@ -1859,6 +1859,7 @@ class P4Submit(Command, P4UserMap):
1859 filesToAdd.remove(path)
1860 elif modifier == "C":
1861 src, dest = diff['src'], diff['dst']
1862 + all_files.append(dest)
1863 p4_integrate(src, dest)
1864 pureRenameCopy.add(dest)
1865 if diff['src_sha1'] != diff['dst_sha1']:
@@ -1875,6 +1876,7 @@ class P4Submit(Command, P4UserMap):
1876 editedFiles.add(dest)
1877 elif modifier == "R":
1878 src, dest = diff['src'], diff['dst']
1879 + all_files.append(dest)
1880 if self.p4HasMoveCommand:
1881 p4_edit(src) # src must be open before move
1882 p4_move(src, dest) # opens for (move/delete, move/add)
t/t9807-git-p4-submit.sh
+1 -1
@@ -546,7 +546,7 @@ test_expect_success 'submit --update-shelve' '
546 )
547 '
548
549 -test_expect_failure 'update a shelve involving moved and copied files' '
549 +test_expect_success 'update a shelve involving moved and copied files' '
550 test_when_finished cleanup_git &&
551 (
552 cd "$cli" &&