Thread (16 messages) flat view 16 messages, 4 authors, 2016-06-16

Re: [PATCH/RFC v1 1/1] No duplicate CRLF rewrite warnings on commit

From: Eric Sunshine <hidden>
Date: 2016-06-16 02:19:23

On Sun, May 15, 2016 at 2:08 AM,  [off-list ref] wrote:
quoted hunk ↗ jump to hunk
If .gitattributes are used to enable CRLF->LF rewriting,
then commiting a file that would have its line endings rewritten,
the "CRLF will be replaced by LF" warning is printed 2 times.
A user expects it to be printed only once.
The automatic rename detection by Git runs the conversion twice,
suppress the warning in the second run.

Reported-By: Adam Dinwoodie <redacted>
Signed-off-by: Torsten Bögershausen <redacted>
---
diff --git a/t/t0020-crlf.sh b/t/t0020-crlf.sh
@@ -86,6 +86,20 @@ test_expect_success 'safecrlf: print warning only once' '
+test_expect_success 'safecrlf: print warning only once on commit' '
+
+       git config core.autocrlf input &&
+       git config core.safecrlf warn &&
+
+       for w in I am all LF; do echo $w; done >doublewarn2 &&
I would typically say something about how you could instead use:

    test_write_lines I am all LF >doublewarn2 &&

but since you're just mimicking existing style in this script, I won't
mention it.
+       git add doublewarn2 &&
+       git commit -m "nowarn" &&
+       for w in Oh here is CRLFQ in text; do echo $w; done | q_to_cr >doublewarn2 &&
Likewise; note my silence.
+       git add doublewarn2 2>&1 &&
+       git commit -m Message 2>&1 | grep "CRLF will be replaced by LF" >actual &&
+       echo "warning: CRLF will be replaced by LF in doublewarn2." >expected &&
+       test_cmp expected actual
+'
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help