Re: [PATCH v3 2/2] File commited with CRLF should roundtrip diff and apply

2017-08-17 Thread Junio C Hamano
tbo...@web.de writes: > @@ -1712,11 +1726,15 @@ static int parse_fragment(struct apply_state *state, > if (!deleted && !added) > leading++; > trailing++; > + if (!state->apply_in_reverse) > +

Re: [PATCH v3 2/2] File commited with CRLF should roundtrip diff and apply

2017-08-17 Thread Junio C Hamano
tbo...@web.de writes: > Changes since v2: > - Manually integrated all code changes from Junio > (Thanks, I hope that I didn't miss something) I suspect that "apply -R makes '+' preimage" change is not here. > - Having examples of "git diff" in the commit message confuses "git apply", > so

[PATCH v3 2/2] File commited with CRLF should roundtrip diff and apply

2017-08-17 Thread tboegi
From: Torsten Bögershausen When a file had been commited with CRLF but now .gitattributes say "* text=auto" (or core.autocrlf is true), the following does not roundtrip, `git apply` fails: printf "Added line\r\n" >>file && git diff >patch && git checkout -- . && git apply patch