1 From db3d45c7a5b8773f6221516c015add695708e0fe Mon Sep 17 00:00:00 2001
2 From: Sven Strickroth <email@cs-ware.de>
3 Date: Sun, 29 Jan 2017 02:12:07 +0100
4 Subject: [PATCH] Update workdir_to_infex CrLf conversion to match Git >=
7 Signed-off-by: Sven Strickroth <email@cs-ware.de>
9 src/crlf.c | 19 +++++++++++--------
10 1 files changed, 10 insertions(+), 9 deletions(-)
12 diff --git a/src/crlf.c b/src/crlf.c
13 index 468f33b4c..97b29af5c 100644
16 @@ -161,9 +161,10 @@ static int crlf_apply_to_odb(
18 /* If safecrlf is enabled, sanity-check the result. */
19 if (ca->crlf_action == GIT_CRLF_INPUT ||
20 - (ca->auto_crlf == GIT_AUTO_CRLF_INPUT &&
21 - (ca->crlf_action == GIT_CRLF_GUESS || ca->crlf_action == GIT_CRLF_AUTO ||
22 - (ca->crlf_action == GIT_CRLF_TEXT && ca->eol==GIT_EOL_UNSET)))) {
23 + (ca->crlf_action == GIT_CRLF_GUESS || ca->crlf_action == GIT_CRLF_AUTO || ca->crlf_action == GIT_CRLF_TEXT) && ca->eol == GIT_EOL_LF ||
24 + (ca->auto_crlf == GIT_AUTO_CRLF_INPUT && (ca->crlf_action == GIT_CRLF_GUESS)) ||
25 + (ca->auto_crlf == GIT_AUTO_CRLF_INPUT && (ca->crlf_action == GIT_CRLF_AUTO || ca->crlf_action == GIT_CRLF_TEXT) && ca->eol == GIT_EOL_UNSET) ||
26 + (GIT_EOL_NATIVE != GIT_EOL_CRLF && ca->auto_crlf == GIT_AUTO_CRLF_FALSE && (ca->crlf_action == GIT_CRLF_AUTO || ca->crlf_action == GIT_CRLF_TEXT) && ca->eol == GIT_EOL_UNSET)) {
28 switch (ca->safe_crlf) {
29 case GIT_SAFE_CRLF_FAIL:
30 @@ -178,9 +179,11 @@ static int crlf_apply_to_odb(
34 - } else if (ca->crlf_action == GIT_CRLF_CRLF ||
35 - (ca->auto_crlf == GIT_AUTO_CRLF_TRUE && ca->crlf_action == GIT_CRLF_GUESS ||
36 - ((ca->crlf_action == GIT_CRLF_TEXT || ca->crlf_action == GIT_CRLF_AUTO) && ca->eol == GIT_EOL_UNSET))) {
37 + } else if ((ca->crlf_action == GIT_CRLF_CRLF ||
38 + ((ca->crlf_action == GIT_CRLF_GUESS || ca->crlf_action == GIT_CRLF_AUTO || ca->crlf_action == GIT_CRLF_TEXT) && ca->eol == GIT_EOL_CRLF) ||
39 + (ca->auto_crlf == GIT_AUTO_CRLF_TRUE && (ca->crlf_action == GIT_CRLF_GUESS)) ||
40 + (ca->crlf_action == GIT_CRLF_AUTO || ca->crlf_action == GIT_CRLF_TEXT)) &&
41 + !(GIT_EOL_NATIVE != GIT_EOL_CRLF && ca->auto_crlf == GIT_AUTO_CRLF_FALSE && (ca->crlf_action == GIT_CRLF_AUTO || ca->crlf_action == GIT_CRLF_TEXT) && ca->eol == GIT_EOL_UNSET)) {
42 if (stats.lf != stats.crlf) {
43 switch (ca->safe_crlf) {
44 case GIT_SAFE_CRLF_FAIL:
45 @@ -321,8 +324,6 @@ static int crlf_check(
46 * Use the core Git logic to see if we should perform CRLF for this file
47 * based on its attributes & the value of `core.autocrlf`
49 - ca.crlf_action = crlf_input_action(&ca);
51 if (ca.crlf_action == GIT_CRLF_BINARY)
52 return GIT_PASSTHROUGH;
54 @@ -330,6 +331,8 @@ static int crlf_check(
55 ((ca.crlf_action == GIT_CRLF_AUTO || ca.crlf_action == GIT_CRLF_TEXT) &&
56 git_filter_source_mode(src) == GIT_FILTER_SMUDGE)) {
58 + ca.crlf_action = crlf_input_action(&ca);
60 if (ca.crlf_action == GIT_CRLF_GUESS &&
61 ca.auto_crlf == GIT_AUTO_CRLF_FALSE)
62 return GIT_PASSTHROUGH;