@@ -271,6 +271,48 @@ test_expect_success 'cleanup commit messages (scissors option,-F,-e, scissors on
271
271
test_must_be_empty actual
272
272
'
273
273
274
+ test_expect_success ' helper-editor' '
275
+
276
+ write_script lf-to-crlf.sh <<-\EOF
277
+ sed "s/\$/Q/" <"$1" | tr Q "\\015" >"$1".new &&
278
+ mv -f "$1".new "$1"
279
+ EOF
280
+ '
281
+
282
+ test_expect_success ' cleanup commit messages (scissors option,-F,-e, CR/LF line endings)' '
283
+
284
+ test_config core.editor "\"$PWD/lf-to-crlf.sh\"" &&
285
+ scissors="# ------------------------ >8 ------------------------" &&
286
+
287
+ test_write_lines >text \
288
+ "# Keep this comment" "" " $scissors" \
289
+ "# Keep this comment, too" "$scissors" \
290
+ "# Remove this comment" "$scissors" \
291
+ "Remove this comment, too" &&
292
+
293
+ test_write_lines >expect \
294
+ "# Keep this comment" "" " $scissors" \
295
+ "# Keep this comment, too" &&
296
+
297
+ git commit --cleanup=scissors -e -F text --allow-empty &&
298
+ git cat-file -p HEAD >raw &&
299
+ sed -e "1,/^\$/d" raw >actual &&
300
+ test_cmp expect actual
301
+ '
302
+
303
+ test_expect_success ' cleanup commit messages (scissors option,-F,-e, scissors on first line, CR/LF line endings)' '
304
+
305
+ scissors="# ------------------------ >8 ------------------------" &&
306
+ test_write_lines >text \
307
+ "$scissors" \
308
+ "# Remove this comment and any following lines" &&
309
+ cp text /tmp/test2-text &&
310
+ git commit --cleanup=scissors -e -F text --allow-empty --allow-empty-message &&
311
+ git cat-file -p HEAD >raw &&
312
+ sed -e "1,/^\$/d" raw >actual &&
313
+ test_must_be_empty actual
314
+ '
315
+
274
316
test_expect_success ' cleanup commit messages (strip option,-F)' '
275
317
276
318
echo >>negative &&
0 commit comments