Skip to content

Commit ef8f8ec

Browse files
committed
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.
1 parent 59b054c commit ef8f8ec

File tree

3 files changed

+215
-201
lines changed

3 files changed

+215
-201
lines changed

src/buf_text.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,7 @@ bool git_buf_text_gather_stats(
310310
}
311311
}
312312

313-
return (stats->nul > 0 ||
313+
/* Treat files with a bare CR as binary */
314+
return (stats->cr != stats->crlf || stats->nul > 0 ||
314315
((stats->printable >> 7) < stats->nonprintable));
315316
}

0 commit comments

Comments
 (0)