]> git.ipfire.org Git - thirdparty/git.git/blame - t/t9826-git-p4-keep-empty-commits.sh
Merge branch 'wb/fsmonitor-bitmap-fix'
[thirdparty/git.git] / t / t9826-git-p4-keep-empty-commits.sh
CommitLineData
4ae048e6
LS
1#!/bin/sh
2
3test_description='Clone repositories and keep empty commits'
4
5. ./lib-git-p4.sh
6
7test_expect_success 'start p4d' '
8 start_p4d
9'
10
11test_expect_success 'Create a repo' '
12 client_view "//depot/... //client/..." &&
13 (
14 cd "$cli" &&
15
16 mkdir -p subdir &&
17
18 >subdir/file1.txt &&
19 p4 add subdir/file1.txt &&
20 p4 submit -d "Add file 1" &&
21
22 >file2.txt &&
23 p4 add file2.txt &&
24 p4 submit -d "Add file 2" &&
25
26 >subdir/file3.txt &&
27 p4 add subdir/file3.txt &&
28 p4 submit -d "Add file 3" &&
29
30 >file4.txt &&
31 p4 add file4.txt &&
32 p4 submit -d "Add file 4" &&
33
34 p4 delete subdir/file3.txt &&
35 p4 submit -d "Remove file 3" &&
36
37 p4 delete file4.txt &&
38 p4 submit -d "Remove file 4"
39 )
40'
41
42test_expect_success 'Clone repo root path with all history' '
43 client_view "//depot/... //client/..." &&
44 test_when_finished cleanup_git &&
45 (
46 cd "$git" &&
47 git init . &&
48 git p4 clone --use-client-spec --destination="$git" //depot@all &&
49 cat >expect <<-\EOF &&
a98772c6
JD
50 Remove file 4
51 [git-p4: depot-paths = "//depot/": change = 6]
4ae048e6 52
a98772c6
JD
53 Remove file 3
54 [git-p4: depot-paths = "//depot/": change = 5]
4ae048e6 55
a98772c6
JD
56 Add file 4
57 [git-p4: depot-paths = "//depot/": change = 4]
4ae048e6 58
a98772c6
JD
59 Add file 3
60 [git-p4: depot-paths = "//depot/": change = 3]
4ae048e6 61
a98772c6
JD
62 Add file 2
63 [git-p4: depot-paths = "//depot/": change = 2]
4ae048e6 64
a98772c6
JD
65 Add file 1
66 [git-p4: depot-paths = "//depot/": change = 1]
4ae048e6
LS
67
68 EOF
69 git log --format=%B >actual &&
70 test_cmp expect actual
71 )
72'
73
74test_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 &&
77 (
78 cd "$git" &&
79 git init . &&
80 git config git-p4.keepEmptyCommits true &&
81 git p4 clone --use-client-spec --destination="$git" //depot@all &&
82 cat >expect <<-\EOF &&
a98772c6
JD
83 Remove file 4
84 [git-p4: depot-paths = "//depot/": change = 6]
4ae048e6 85
a98772c6
JD
86 Remove file 3
87 [git-p4: depot-paths = "//depot/": change = 5]
4ae048e6 88
a98772c6
JD
89 Add file 4
90 [git-p4: depot-paths = "//depot/": change = 4]
4ae048e6 91
a98772c6
JD
92 Add file 3
93 [git-p4: depot-paths = "//depot/": change = 3]
4ae048e6 94
a98772c6
JD
95 Add file 2
96 [git-p4: depot-paths = "//depot/": change = 2]
4ae048e6 97
a98772c6
JD
98 Add file 1
99 [git-p4: depot-paths = "//depot/": change = 1]
4ae048e6
LS
100
101 EOF
102 git log --format=%B >actual &&
103 test_cmp expect actual
104 )
105'
106
107test_expect_success 'Clone repo subdir with all history' '
108 client_view "//depot/subdir/... //client/subdir/..." &&
109 test_when_finished cleanup_git &&
110 (
111 cd "$git" &&
112 git init . &&
113 git p4 clone --use-client-spec --destination="$git" --verbose //depot@all &&
114 cat >expect <<-\EOF &&
a98772c6
JD
115 Remove file 3
116 [git-p4: depot-paths = "//depot/": change = 5]
4ae048e6 117
a98772c6
JD
118 Add file 3
119 [git-p4: depot-paths = "//depot/": change = 3]
4ae048e6 120
a98772c6
JD
121 Add file 1
122 [git-p4: depot-paths = "//depot/": change = 1]
4ae048e6
LS
123
124 EOF
125 git log --format=%B >actual &&
126 test_cmp expect actual
127 )
128'
129
4ae048e6 130test_done