Sync with 2.40.2
[git.git] / t / t9834-git-p4-file-dir-bug.sh
blobdac67e89d7d720a916eec8a533d9b1f05101525a
1 #!/bin/sh
3 test_description='git p4 directory/file bug handling
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.'
9 . ./lib-git-p4.sh
11 test_expect_success 'start p4d' '
12 start_p4d &&
13 { p4 configure set submit.collision.check=0 || :; }
16 test_expect_success 'init depot' '
18 cd "$cli" &&
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" &&
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" &&
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" &&
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"
50 test_expect_success 'clone with git-p4' '
51 git p4 clone --dest="$git" //depot/@1,3
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"
61 test_expect_success 'rebase and check empty' '
62 git -C "$git" p4 rebase &&
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"
70 test_done