aboutsummaryrefslogtreecommitdiff
path: root/convert.c
diff options
context:
space:
mode:
authorTorsten Bögershausen <tboegi@web.de>2017-08-13 10:51:04 +0200
committerJunio C Hamano <gitster@pobox.com>2017-08-16 10:21:17 -0700
commit2fea9de61857986431982ae89c01c89a2fc10038 (patch)
treefb99259a2d520ddeafd90022a52cc696b24234fc /convert.c
parent4d7268b888d7bb6d675340ec676e4239739d0f6d (diff)
downloadgit-2fea9de61857986431982ae89c01c89a2fc10038.tar.gz
git-2fea9de61857986431982ae89c01c89a2fc10038.tar.xz
convert: add SAFE_CRLF_KEEP_CRLF
When convert_to_git() is called, the caller may want to keep CRLF to be kept as CRLF (and not converted into LF). This will be used in the next commit, when apply works with files that have CRLF and patches are applied onto these files. Add the new value "SAFE_CRLF_KEEP_CRLF" to safe_crlf. Prepare convert_to_git() to be able to run the clean filter, skip the CRLF conversion and run the ident filter. Signed-off-by: Torsten Bögershausen <tboegi@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'convert.c')
-rw-r--r--convert.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/convert.c b/convert.c
index deaf0ba7b..040123b4f 100644
--- a/convert.c
+++ b/convert.c
@@ -1104,10 +1104,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);
}