32
mesg_with_footer_sob="$mesg_with_footer
33
Signed-off-by: $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL>"
34
35
+mesg_with_cherry_footer="$mesg_with_footer_sob
36
+(cherry picked from commit da39a3ee5e6b4b0d3255bfef95601890afd80709)
37
+Tested-by: C.U. Thor <cuthor@example.com>"
38
+
39
40
test_expect_success setup '
41
git config advice.detachedhead false &&
51
test_commit "$mesg_with_footer" foo b mesg-with-footer &&
52
git reset --hard initial &&
53
test_commit "$mesg_with_footer_sob" foo b mesg-with-footer-sob &&
54
+ git reset --hard initial &&
55
+ test_commit "$mesg_with_cherry_footer" foo b mesg-with-cherry-footer &&
56
pristine_detach initial &&
57
test_commit conflicting unrelated
58
'
104
test_cmp expect actual
105
'
106
107
+test_expect_success 'cherry-pick -x -s adds sob when last sob doesnt match committer' '
108
+ pristine_detach initial &&
109
+ sha1=`git rev-parse mesg-with-footer^0` &&
110
+ git cherry-pick -x -s mesg-with-footer &&
111
+ cat <<-EOF >expect &&
112
+ $mesg_with_footer
113
+ (cherry picked from commit $sha1)
114
+ Signed-off-by: $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL>
115
+ EOF
116
+ git log -1 --pretty=format:%B >actual &&
117
+ test_cmp expect actual
118
+'
119
+
120
test_expect_success 'cherry-pick -s refrains from adding duplicate trailing sob' '
121
pristine_detach initial &&
122
git cherry-pick -s mesg-with-footer-sob &&
127
test_cmp expect actual
128
'
129
130
+test_expect_success 'cherry-pick -x -s adds sob even when trailing sob exists for committer' '
131
+ pristine_detach initial &&
132
+ sha1=`git rev-parse mesg-with-footer-sob^0` &&
133
+ git cherry-pick -x -s mesg-with-footer-sob &&
134
+ cat <<-EOF >expect &&
135
+ $mesg_with_footer_sob
136
+ (cherry picked from commit $sha1)
137
+ Signed-off-by: $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL>
138
+ EOF
139
+ git log -1 --pretty=format:%B >actual &&
140
+ test_cmp expect actual
141
+'
142
+
143
+test_expect_success 'cherry-pick -x treats "(cherry picked from..." line as part of footer' '
144
+ pristine_detach initial &&
145
+ sha1=`git rev-parse mesg-with-cherry-footer^0` &&
146
+ git cherry-pick -x mesg-with-cherry-footer &&
147
+ cat <<-EOF >expect &&
148
+ $mesg_with_cherry_footer
149
+ (cherry picked from commit $sha1)
150
+ EOF
151
+ git log -1 --pretty=format:%B >actual &&
152
+ test_cmp expect actual
153
+'
154
+
155
+test_expect_success 'cherry-pick -s treats "(cherry picked from..." line as part of footer' '
156
+ pristine_detach initial &&
157
+ git cherry-pick -s mesg-with-cherry-footer &&
158
+ cat <<-EOF >expect &&
159
+ $mesg_with_cherry_footer
160
+ Signed-off-by: $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL>
161
+ EOF
162
+ git log -1 --pretty=format:%B >actual &&
163
+ test_cmp expect actual
164
+'
165
+
166
test_done