Merge branch 'tb/apply-with-crlf'
"git apply" that is used as a better "patch -p1" failed to apply a taken from a file with CRLF line endings to a file with CRLF line endings. The root cause was because it misused convert_to_git() that tried to do "safe-crlf" processing by looking at the index entry at the same path, which is a nonsense---in that mode, "apply" is not working on the data in (or derived from) the index at all. This has been fixed. * tb/apply-with-crlf: apply: file commited with CRLF should roundtrip diff and apply convert: add SAFE_CRLF_KEEP_CRLF
This commit is contained in:
10
convert.c
10
convert.c
@ -1132,10 +1132,12 @@ int convert_to_git(const struct index_state *istate,
|
||||
src = dst->buf;
|
||||
len = dst->len;
|
||||
}
|
||||
ret |= crlf_to_git(istate, path, src, len, dst, ca.crlf_action, checksafe);
|
||||
if (ret && dst) {
|
||||
src = dst->buf;
|
||||
len = dst->len;
|
||||
if (checksafe != SAFE_CRLF_KEEP_CRLF) {
|
||||
ret |= crlf_to_git(istate, path, src, len, dst, ca.crlf_action, checksafe);
|
||||
if (ret && dst) {
|
||||
src = dst->buf;
|
||||
len = dst->len;
|
||||
}
|
||||
}
|
||||
return ret | ident_to_git(path, src, len, dst, ca.ident);
|
||||
}
|
||||
|
Reference in New Issue
Block a user