3 test_description='Clone repositories and keep empty commits'
7 test_expect_success 'start p4d' '
11 test_expect_success 'Create a repo' '
12 client_view "//depot/... //client/..." &&
19 p4 add subdir/file1.txt &&
20 p4 submit -d "Add file 1" &&
24 p4 submit -d "Add file 2" &&
27 p4 add subdir/file3.txt &&
28 p4 submit -d "Add file 3" &&
32 p4 submit -d "Add file 4" &&
34 p4 delete subdir/file3.txt &&
35 p4 submit -d "Remove file 3" &&
37 p4 delete file4.txt &&
38 p4 submit -d "Remove file 4"
42 test_expect_success 'Clone repo root path with all history' '
43 client_view "//depot/... //client/..." &&
44 test_when_finished cleanup_git &&
48 git p4 clone --use-client-spec --destination="$git" //depot@all &&
49 cat >expect <<-\EOF &&
51 [git-p4: depot-paths = "//depot/": change = 6]
54 [git-p4: depot-paths = "//depot/": change = 5]
57 [git-p4: depot-paths = "//depot/": change = 4]
60 [git-p4: depot-paths = "//depot/": change = 3]
63 [git-p4: depot-paths = "//depot/": change = 2]
66 [git-p4: depot-paths = "//depot/": change = 1]
69 git log --format=%B >actual &&
70 test_cmp expect actual
74 test_expect_success 'Clone repo subdir with all history but keep empty commits' '
75 client_view "//depot/subdir/... //client/subdir/..." &&
76 test_when_finished cleanup_git &&
80 git config git-p4.keepEmptyCommits true &&
81 git p4 clone --use-client-spec --destination="$git" //depot@all &&
82 cat >expect <<-\EOF &&
84 [git-p4: depot-paths = "//depot/": change = 6]
87 [git-p4: depot-paths = "//depot/": change = 5]
90 [git-p4: depot-paths = "//depot/": change = 4]
93 [git-p4: depot-paths = "//depot/": change = 3]
96 [git-p4: depot-paths = "//depot/": change = 2]
99 [git-p4: depot-paths = "//depot/": change = 1]
102 git log --format=%B >actual &&
103 test_cmp expect actual
107 test_expect_success 'Clone repo subdir with all history' '
108 client_view "//depot/subdir/... //client/subdir/..." &&
109 test_when_finished cleanup_git &&
113 git p4 clone --use-client-spec --destination="$git" --verbose //depot@all &&
114 cat >expect <<-\EOF &&
116 [git-p4: depot-paths = "//depot/": change = 5]
119 [git-p4: depot-paths = "//depot/": change = 3]
122 [git-p4: depot-paths = "//depot/": change = 1]
125 git log --format=%B >actual &&
126 test_cmp expect actual
130 test_expect_success 'kill p4d' '