summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2014-05-19 15:05:39 -0700
committerRussell Belfer <rb@github.com>2014-05-19 15:05:39 -0700
commitc094197bf92736bb1c40cf1ca87bda970ab7f999 (patch)
treebb1ae88e1ad98895dc07d2b5a118dc6103efd049
parent16798d08cf3a1757deb9f0363b35fbf775cfc3fb (diff)
downloadlibgit2-rb/safecrlf-on-lf-platform.tar.gz
Just don't CRLF filter if there are no CRsrb/safecrlf-on-lf-platform
-rw-r--r--src/crlf.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/crlf.c b/src/crlf.c
index 22cba84ab..821e04eb2 100644
--- a/src/crlf.c
+++ b/src/crlf.c
@@ -138,10 +138,12 @@ static int crlf_apply_to_odb(
if (git_buf_text_gather_stats(&stats, from, false))
return GIT_PASSTHROUGH;
- /* If safecrlf is enabled, sanity-check the result. */
- if (stats.cr != stats.crlf ||
- (stats.crlf > 0 && stats.lf != stats.crlf)) {
+ /* If there are no CR characters to filter out, then just pass */
+ if (!stats.cr)
+ return GIT_PASSTHROUGH;
+ /* If safecrlf is enabled, sanity-check the result. */
+ if (stats.cr != stats.crlf || stats.lf != stats.crlf) {
switch (ca->safe_crlf) {
case GIT_SAFE_CRLF_FAIL:
giterr_set(