Andrew Oakley | 82e46d6 | 2020-05-10 11:16:50 +0100 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
| 3 | test_description='git p4 directory/file bug handling |
| 4 | |
| 5 | This test creates files and directories with the same name in perforce and |
| 6 | checks that git-p4 recovers from the error at the same time as the perforce |
| 7 | repository.' |
| 8 | |
| 9 | . ./lib-git-p4.sh |
| 10 | |
| 11 | test_expect_success 'start p4d' ' |
| 12 | start_p4d && |
Denton Liu | 6e7b0ea | 2020-07-07 02:04:37 -0400 | [diff] [blame] | 13 | { p4 configure set submit.collision.check=0 || :; } |
Andrew Oakley | 82e46d6 | 2020-05-10 11:16:50 +0100 | [diff] [blame] | 14 | ' |
| 15 | |
| 16 | test_expect_success 'init depot' ' |
| 17 | ( |
| 18 | cd "$cli" && |
| 19 | |
| 20 | touch add_file_add_dir_del_file add_file_add_dir_del_dir && |
| 21 | p4 add add_file_add_dir_del_file add_file_add_dir_del_dir && |
| 22 | mkdir add_dir_add_file_del_file add_dir_add_file_del_dir && |
| 23 | touch add_dir_add_file_del_file/file add_dir_add_file_del_dir/file && |
| 24 | p4 add add_dir_add_file_del_file/file add_dir_add_file_del_dir/file && |
| 25 | p4 submit -d "add initial" && |
| 26 | |
| 27 | rm -f add_file_add_dir_del_file add_file_add_dir_del_dir && |
| 28 | mkdir add_file_add_dir_del_file add_file_add_dir_del_dir && |
| 29 | touch add_file_add_dir_del_file/file add_file_add_dir_del_dir/file && |
| 30 | p4 add add_file_add_dir_del_file/file add_file_add_dir_del_dir/file && |
| 31 | rm -rf add_dir_add_file_del_file add_dir_add_file_del_dir && |
| 32 | touch add_dir_add_file_del_file add_dir_add_file_del_dir && |
| 33 | p4 add add_dir_add_file_del_file add_dir_add_file_del_dir && |
| 34 | p4 submit -d "add conflicting" && |
| 35 | |
| 36 | p4 delete -k add_file_add_dir_del_file && |
| 37 | p4 delete -k add_file_add_dir_del_dir/file && |
| 38 | p4 delete -k add_dir_add_file_del_file && |
| 39 | p4 delete -k add_dir_add_file_del_dir/file && |
| 40 | p4 submit -d "delete conflicting" && |
| 41 | |
| 42 | p4 delete -k "add_file_add_dir_del_file/file" && |
| 43 | p4 delete -k "add_file_add_dir_del_dir" && |
| 44 | p4 delete -k "add_dir_add_file_del_file/file" && |
| 45 | p4 delete -k "add_dir_add_file_del_dir" && |
| 46 | p4 submit -d "delete remaining" |
| 47 | ) |
| 48 | ' |
| 49 | |
| 50 | test_expect_success 'clone with git-p4' ' |
| 51 | git p4 clone --dest="$git" //depot/@1,3 |
| 52 | ' |
| 53 | |
| 54 | test_expect_success 'check contents' ' |
| 55 | test_path_is_dir "$git/add_file_add_dir_del_file" && |
| 56 | test_path_is_file "$git/add_file_add_dir_del_dir" && |
| 57 | test_path_is_dir "$git/add_dir_add_file_del_file" && |
| 58 | test_path_is_file "$git/add_dir_add_file_del_dir" |
| 59 | ' |
| 60 | |
| 61 | test_expect_success 'rebase and check empty' ' |
| 62 | git -C "$git" p4 rebase && |
| 63 | |
| 64 | test_path_is_missing "$git/add_file_add_dir_del_file" && |
| 65 | test_path_is_missing "$git/add_file_add_dir_del_dir" && |
| 66 | test_path_is_missing "$git/add_dir_add_file_del_file" && |
| 67 | test_path_is_missing "$git/add_dir_add_file_del_dir" |
| 68 | ' |
| 69 | |
| 70 | test_done |