Merge branch 'rj/cygwin-has-dev-tty'
[git/gitster.git] / t / t9834-git-p4-file-dir-bug.sh
blob565870fc740cb228d9b614920e13a53da118641d
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 TEST_PASSES_SANITIZE_LEAK=true
10 . ./lib-git-p4.sh
12 test_expect_success 'start p4d' '
13 start_p4d &&
14 { p4 configure set submit.collision.check=0 || :; }
17 test_expect_success 'init depot' '
19 cd "$cli" &&
21 touch add_file_add_dir_del_file add_file_add_dir_del_dir &&
22 p4 add add_file_add_dir_del_file add_file_add_dir_del_dir &&
23 mkdir add_dir_add_file_del_file add_dir_add_file_del_dir &&
24 touch add_dir_add_file_del_file/file add_dir_add_file_del_dir/file &&
25 p4 add add_dir_add_file_del_file/file add_dir_add_file_del_dir/file &&
26 p4 submit -d "add initial" &&
28 rm -f add_file_add_dir_del_file add_file_add_dir_del_dir &&
29 mkdir add_file_add_dir_del_file add_file_add_dir_del_dir &&
30 touch add_file_add_dir_del_file/file add_file_add_dir_del_dir/file &&
31 p4 add add_file_add_dir_del_file/file add_file_add_dir_del_dir/file &&
32 rm -rf add_dir_add_file_del_file add_dir_add_file_del_dir &&
33 touch add_dir_add_file_del_file add_dir_add_file_del_dir &&
34 p4 add add_dir_add_file_del_file add_dir_add_file_del_dir &&
35 p4 submit -d "add conflicting" &&
37 p4 delete -k add_file_add_dir_del_file &&
38 p4 delete -k add_file_add_dir_del_dir/file &&
39 p4 delete -k add_dir_add_file_del_file &&
40 p4 delete -k add_dir_add_file_del_dir/file &&
41 p4 submit -d "delete conflicting" &&
43 p4 delete -k "add_file_add_dir_del_file/file" &&
44 p4 delete -k "add_file_add_dir_del_dir" &&
45 p4 delete -k "add_dir_add_file_del_file/file" &&
46 p4 delete -k "add_dir_add_file_del_dir" &&
47 p4 submit -d "delete remaining"
51 test_expect_success 'clone with git-p4' '
52 git p4 clone --dest="$git" //depot/@1,3
55 test_expect_success 'check contents' '
56 test_path_is_dir "$git/add_file_add_dir_del_file" &&
57 test_path_is_file "$git/add_file_add_dir_del_dir" &&
58 test_path_is_dir "$git/add_dir_add_file_del_file" &&
59 test_path_is_file "$git/add_dir_add_file_del_dir"
62 test_expect_success 'rebase and check empty' '
63 git -C "$git" p4 rebase &&
65 test_path_is_missing "$git/add_file_add_dir_del_file" &&
66 test_path_is_missing "$git/add_file_add_dir_del_dir" &&
67 test_path_is_missing "$git/add_dir_add_file_del_file" &&
68 test_path_is_missing "$git/add_dir_add_file_del_dir"
71 test_done