MCPcopy Create free account
hub / github.com/git/git / will_convert_lf_to_crlf

Function will_convert_lf_to_crlf

convert.c:247–267  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

245}
246
247static int will_convert_lf_to_crlf(struct text_stat *stats,
248 enum convert_crlf_action crlf_action)
249{
250 if (output_eol(crlf_action) != EOL_CRLF)
251 return 0;
252 /* No "naked" LF? Nothing to convert, regardless. */
253 if (!stats->lonelf)
254 return 0;
255
256 if (crlf_action == CRLF_AUTO || crlf_action == CRLF_AUTO_INPUT || crlf_action == CRLF_AUTO_CRLF) {
257 /* If we have any CR or CRLF line endings, we do not touch it */
258 /* This is the new safer autocrlf-handling */
259 if (stats->lonecr || stats->crlf)
260 return 0;
261
262 if (convert_is_binary(stats))
263 return 0;
264 }
265 return 1;
266
267}
268
269static int validate_encoding(const char *path, const char *enc,
270 const char *data, size_t len, int die_on_error)

Callers 2

crlf_to_gitFunction · 0.85
crlf_to_worktreeFunction · 0.85

Calls 2

output_eolFunction · 0.85
convert_is_binaryFunction · 0.85

Tested by

no test coverage detected