@@ -605,6 +605,48 @@ test_expect_success 'cleanup commit messages (scissors option,-F,-e, scissors on
605
605
test_must_be_empty actual
606
606
'
607
607
608
+ test_expect_success ' helper-editor' '
609
+
610
+ write_script lf-to-crlf.sh <<-\EOF
611
+ sed "s/\$/Q/" <"$1" | tr Q "\\015" >"$1".new &&
612
+ mv -f "$1".new "$1"
613
+ EOF
614
+ '
615
+
616
+ test_expect_success ' cleanup commit messages (scissors option,-F,-e, CR/LF line endings)' '
617
+
618
+ test_config core.editor "\"$PWD/lf-to-crlf.sh\"" &&
619
+ scissors="# ------------------------ >8 ------------------------" &&
620
+
621
+ test_write_lines >text \
622
+ "# Keep this comment" "" " $scissors" \
623
+ "# Keep this comment, too" "$scissors" \
624
+ "# Remove this comment" "$scissors" \
625
+ "Remove this comment, too" &&
626
+
627
+ test_write_lines >expect \
628
+ "# Keep this comment" "" " $scissors" \
629
+ "# Keep this comment, too" &&
630
+
631
+ git commit --cleanup=scissors -e -F text --allow-empty &&
632
+ git cat-file -p HEAD >raw &&
633
+ sed -e "1,/^\$/d" raw >actual &&
634
+ test_cmp expect actual
635
+ '
636
+
637
+ test_expect_success ' cleanup commit messages (scissors option,-F,-e, scissors on first line, CR/LF line endings)' '
638
+
639
+ scissors="# ------------------------ >8 ------------------------" &&
640
+ test_write_lines >text \
641
+ "$scissors" \
642
+ "# Remove this comment and any following lines" &&
643
+ cp text /tmp/test2-text &&
644
+ git commit --cleanup=scissors -e -F text --allow-empty --allow-empty-message &&
645
+ git cat-file -p HEAD >raw &&
646
+ sed -e "1,/^\$/d" raw >actual &&
647
+ test_must_be_empty actual
648
+ '
649
+
608
650
test_expect_success ' cleanup commit messages (strip option,-F)' '
609
651
610
652
echo >>negative &&
0 commit comments