RebaseDlg: Show renames in conflicted files list
[TortoiseGit.git] / ext / libgit2-0003-Adding-a-CRLF-file-with-core.autocrlf-input-and-core.patch
blobcb04ae6dd13b4e1b839ed75c68738fd1f6774f36
1 From 15d05a0c3e9ad4dfe75d17e23304e338726de9f8 Mon Sep 17 00:00:00 2001
2 From: Sven Strickroth <email@cs-ware.de>
3 Date: Fri, 23 Jan 2015 15:34:14 +0100
4 Subject: [PATCH 3/6] Adding a CRLF-file with core.autocrlf=input and
5 core.safecrlf=true does not fail as with vanilla git
7 Signed-off-by: Sven Strickroth <email@cs-ware.de>
8 ---
9 CHANGELOG.md | 1 +
10 src/crlf.c | 13 +++++++++++++
11 tests/index/crlf.c | 6 ++++++
12 3 files changed, 20 insertions(+)
14 diff --git a/CHANGELOG.md b/CHANGELOG.md
15 index 8fb39cd..c31d921 100644
16 --- a/CHANGELOG.md
17 +++ b/CHANGELOG.md
18 @@ -12,6 +12,7 @@ v0.22 + 1
20 * LF -> CRLF filter now correctly honors core.safecrlf=true errors
21 * LF only files were accepted with core.autocrlf=true on CRLF platforms
22 + * files containig CRLF in combination with core.autocrlf=input were accepted
24 * Rename and copy detection is enabled for small files.
26 diff --git a/src/crlf.c b/src/crlf.c
27 index 1290c01..29bbb5f 100644
28 --- a/src/crlf.c
29 +++ b/src/crlf.c
30 @@ -156,6 +156,19 @@ static int crlf_apply_to_odb(
31 default:
32 break;
34 + } else if (stats.crlf && ca->auto_crlf == GIT_AUTO_CRLF_INPUT) {
35 + switch (ca->safe_crlf) {
36 + case GIT_SAFE_CRLF_FAIL:
37 + giterr_set(
38 + GITERR_FILTER, "CRLF would be replaced by LF in '%s'",
39 + git_filter_source_path(src));
40 + return -1;
41 + case GIT_SAFE_CRLF_WARN:
42 + /* TODO: issue warning when warning API is available */;
43 + break;
44 + default:
45 + break;
46 + }
50 diff --git a/tests/index/crlf.c b/tests/index/crlf.c
51 index d2f01d1..490d43a 100644
52 --- a/tests/index/crlf.c
53 +++ b/tests/index/crlf.c
54 @@ -358,6 +358,9 @@ void test_index_crlf__safecrlf_true_autocrlf_input_text_auto_attr(void)
56 cl_git_pass(git_oid_fromstr(&oid, FILE_OID_LF));
57 cl_assert_equal_oid(&oid, &entry->id);
59 + cl_git_mkfile("./crlf/newfile2.txt", FILE_CONTENTS_CRLF);
60 + cl_git_fail(git_index_add_bypath(g_index, "newfile2.txt"));
63 void test_index_crlf__safecrlf_true_autocrlf_input_text__no_attr(void)
64 @@ -375,6 +378,9 @@ void test_index_crlf__safecrlf_true_autocrlf_input_text__no_attr(void)
66 cl_git_pass(git_oid_fromstr(&oid, FILE_OID_LF));
67 cl_assert_equal_oid(&oid, &entry->id);
69 + cl_git_mkfile("./crlf/newfile2.txt", FILE_CONTENTS_CRLF);
70 + cl_git_fail(git_index_add_bypath(g_index, "newfile2.txt"));
73 void test_index_crlf__safecrlf_true_no_attrs(void)
74 --
75 2.4.4.windows.2