@@ -623,6 +623,48 @@ test_expect_success 'cleanup commit messages (scissors option,-F,-e, scissors on
623
623
test_must_be_empty actual
624
624
'
625
625
626
+ test_expect_success ' helper-editor' '
627
+
628
+ write_script lf-to-crlf.sh <<-\EOF
629
+ sed "s/\$/Q/" <"$1" | tr Q "\\015" >"$1".new &&
630
+ mv -f "$1".new "$1"
631
+ EOF
632
+ '
633
+
634
+ test_expect_success ' cleanup commit messages (scissors option,-F,-e, CR/LF line endings)' '
635
+
636
+ test_config core.editor "\"$PWD/lf-to-crlf.sh\"" &&
637
+ scissors="# ------------------------ >8 ------------------------" &&
638
+
639
+ test_write_lines >text \
640
+ "# Keep this comment" "" " $scissors" \
641
+ "# Keep this comment, too" "$scissors" \
642
+ "# Remove this comment" "$scissors" \
643
+ "Remove this comment, too" &&
644
+
645
+ test_write_lines >expect \
646
+ "# Keep this comment" "" " $scissors" \
647
+ "# Keep this comment, too" &&
648
+
649
+ git commit --cleanup=scissors -e -F text --allow-empty &&
650
+ git cat-file -p HEAD >raw &&
651
+ sed -e "1,/^\$/d" raw >actual &&
652
+ test_cmp expect actual
653
+ '
654
+
655
+ test_expect_success ' cleanup commit messages (scissors option,-F,-e, scissors on first line, CR/LF line endings)' '
656
+
657
+ scissors="# ------------------------ >8 ------------------------" &&
658
+ test_write_lines >text \
659
+ "$scissors" \
660
+ "# Remove this comment and any following lines" &&
661
+ cp text /tmp/test2-text &&
662
+ git commit --cleanup=scissors -e -F text --allow-empty --allow-empty-message &&
663
+ git cat-file -p HEAD >raw &&
664
+ sed -e "1,/^\$/d" raw >actual &&
665
+ test_must_be_empty actual
666
+ '
667
+
626
668
test_expect_success ' cleanup commit messages (strip option,-F)' '
627
669
628
670
echo >>negative &&
0 commit comments