@@ -586,6 +586,48 @@ test_expect_success 'cleanup commit messages (scissors option,-F,-e, scissors on
586
586
test_must_be_empty actual
587
587
'
588
588
589
+ test_expect_success ' helper-editor' '
590
+
591
+ write_script lf-to-crlf.sh <<-\EOF
592
+ sed "s/\$/Q/" <"$1" | tr Q "\\015" >"$1".new &&
593
+ mv -f "$1".new "$1"
594
+ EOF
595
+ '
596
+
597
+ test_expect_success ' cleanup commit messages (scissors option,-F,-e, CR/LF line endings)' '
598
+
599
+ test_config core.editor "\"$PWD/lf-to-crlf.sh\"" &&
600
+ scissors="# ------------------------ >8 ------------------------" &&
601
+
602
+ test_write_lines >text \
603
+ "# Keep this comment" "" " $scissors" \
604
+ "# Keep this comment, too" "$scissors" \
605
+ "# Remove this comment" "$scissors" \
606
+ "Remove this comment, too" &&
607
+
608
+ test_write_lines >expect \
609
+ "# Keep this comment" "" " $scissors" \
610
+ "# Keep this comment, too" &&
611
+
612
+ git commit --cleanup=scissors -e -F text --allow-empty &&
613
+ git cat-file -p HEAD >raw &&
614
+ sed -e "1,/^\$/d" raw >actual &&
615
+ test_cmp expect actual
616
+ '
617
+
618
+ test_expect_success ' cleanup commit messages (scissors option,-F,-e, scissors on first line, CR/LF line endings)' '
619
+
620
+ scissors="# ------------------------ >8 ------------------------" &&
621
+ test_write_lines >text \
622
+ "$scissors" \
623
+ "# Remove this comment and any following lines" &&
624
+ cp text /tmp/test2-text &&
625
+ git commit --cleanup=scissors -e -F text --allow-empty --allow-empty-message &&
626
+ git cat-file -p HEAD >raw &&
627
+ sed -e "1,/^\$/d" raw >actual &&
628
+ test_must_be_empty actual
629
+ '
630
+
589
631
test_expect_success ' cleanup commit messages (strip option,-F)' '
590
632
591
633
echo >>negative &&
0 commit comments