Provide (experimental) clang-format file
[TortoiseGit.git] / ext / libgit2-0004-Make-files-with-CR-CRLF-not-fail-with-core.safecrlf-.patch
blob004b306a354c4a889d6d3a1722a15adea722d95b
1 From 489591b883f404052dd187962e334342cbebf5d7 Mon Sep 17 00:00:00 2001
2 From: Sven Strickroth <email@cs-ware.de>
3 Date: Fri, 23 Jan 2015 17:15:16 +0100
4 Subject: [PATCH 4/7] Make files with #CR!=#CRLF not fail with
5 core.safecrlf=true
7 Signed-off-by: Sven Strickroth <email@cs-ware.de>
8 ---
9 src/crlf.c | 18 +++++++++---------
10 1 file changed, 9 insertions(+), 9 deletions(-)
12 diff --git a/src/crlf.c b/src/crlf.c
13 index d88ad00f3..f476fe32a 100644
14 --- a/src/crlf.c
15 +++ b/src/crlf.c
16 @@ -142,12 +142,20 @@ static int crlf_apply_to_odb(
17 if (git_buf_text_gather_stats(&stats, from, false))
18 return GIT_PASSTHROUGH;
20 + /*
21 + * We're currently not going to even try to convert stuff
22 + * that has bare CR characters. Does anybody do that crazy
23 + * stuff?
24 + */
25 + if (stats.cr != stats.crlf)
26 + return GIT_PASSTHROUGH;
28 /* If there are no CR characters to filter out and CrLf is not set to "true", then just pass */
29 if (!stats.cr && ca->auto_crlf != GIT_AUTO_CRLF_TRUE)
30 return GIT_PASSTHROUGH;
32 /* If safecrlf is enabled, sanity-check the result. */
33 - if (stats.cr != stats.crlf || stats.lf != stats.crlf) {
34 + if (stats.lf != stats.crlf) {
35 switch (ca->safe_crlf) {
36 case GIT_SAFE_CRLF_FAIL:
37 giterr_set(
38 @@ -175,14 +183,6 @@ static int crlf_apply_to_odb(
42 - /*
43 - * We're currently not going to even try to convert stuff
44 - * that has bare CR characters. Does anybody do that crazy
45 - * stuff?
46 - */
47 - if (stats.cr != stats.crlf)
48 - return GIT_PASSTHROUGH;
50 if (ca->crlf_action == GIT_CRLF_GUESS) {
52 * If the file in the index has any CR in it, do not convert.
53 --
54 2.16.1.windows.4