]> asedeno.scripts.mit.edu Git - git.git/blobdiff - t/t4124-apply-ws-rule.sh
Merge branch 'fc/mutt-alias'
[git.git] / t / t4124-apply-ws-rule.sh
index f83322e513b96bb90e71ce39340515c6be0db186..fac2093d7f20d502f41f895d2ccdfccd5e639e2b 100755 (executable)
@@ -148,4 +148,26 @@ do
        done
 done
 
+create_patch () {
+       sed -e "s/_/ /" <<-\EOF
+               diff --git a/target b/target
+               index e69de29..8bd6648 100644
+               --- a/target
+               +++ b/target
+               @@ -0,0 +1,3 @@
+               +An empty line follows
+               +
+               +A line with trailing whitespace and no newline_
+               \ No newline at end of file
+       EOF
+}
+
+test_expect_success 'trailing whitespace & no newline at the end of file' '
+       >target &&
+       create_patch >patch-file &&
+       git apply --whitespace=fix patch-file &&
+       grep "newline$" target &&
+       grep "^$" target
+'
+
 test_done