Commit ef8f8ec6 by Edward Thomson

crlf: update to match git's logic

Examine the recent CRLF changes to git by Torsten Bögershausen and
include similar changes to update our CRLF logic to match.

Note: Torsten Bögershausen has previously agreed to allow his changes to
be included in libgit2.
parent 59b054cb
......@@ -310,6 +310,7 @@ bool git_buf_text_gather_stats(
}
}
return (stats->nul > 0 ||
/* Treat files with a bare CR as binary */
return (stats->cr != stats->crlf || stats->nul > 0 ||
((stats->printable >> 7) < stats->nonprintable));
}
......@@ -15,16 +15,6 @@
/* Amount of file to examine for NUL byte when checking binary-ness */
#define GIT_FILTER_BYTES_TO_CHECK_NUL 8000
/* Possible CRLF values */
typedef enum {
GIT_CRLF_GUESS = -1,
GIT_CRLF_BINARY = 0,
GIT_CRLF_TEXT,
GIT_CRLF_INPUT,
GIT_CRLF_CRLF,
GIT_CRLF_AUTO,
} git_crlf_t;
typedef struct {
git_attr_session *attr_session;
git_buf *temp_buf;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment