Skip to content

Commit

Permalink
Updated libgit2
Browse files Browse the repository at this point in the history
Signed-off-by: Sup Yut Sum <ch3cooli@gmail.com>
  • Loading branch information
ch3cooli committed Jul 1, 2015
1 parent 14fd688 commit e78b37f
Show file tree
Hide file tree
Showing 13 changed files with 255 additions and 694 deletions.
8 changes: 7 additions & 1 deletion ext/build/libgit2.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@
<ResourceCompile>
<PreprocessorDefinitions>LIBGIT2_FILENAME=\"$(AssemblyName)\";%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ResourceCompile>
<Link>
<AdditionalDependencies>rpcrt4.lib;crypt32.lib;winhttp.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\..\src\libgit2\filter-filter.c" />
Expand Down Expand Up @@ -168,6 +171,9 @@
<ClCompile Include="..\libgit2\src\tsort.c" />
<ClCompile Include="..\libgit2\src\util.c" />
<ClCompile Include="..\libgit2\src\vector.c" />
<ClCompile Include="..\libgit2\src\win32\buffer.c">
<ObjectFileName>$(IntDir)buffer_win32.obj</ObjectFileName>
</ClCompile>
<ClCompile Include="..\libgit2\src\win32\dir.c" />
<ClCompile Include="..\libgit2\src\win32\error.c" />
<ClCompile Include="..\libgit2\src\win32\findfile.c" />
Expand Down Expand Up @@ -215,7 +221,6 @@
<ClInclude Include="..\libgit2\include\git2\message.h" />
<ClInclude Include="..\libgit2\include\git2\patch.h" />
<ClInclude Include="..\libgit2\include\git2\pathspec.h" />
<ClInclude Include="..\libgit2\include\git2\push.h" />
<ClInclude Include="..\libgit2\include\git2\rebase.h" />
<ClInclude Include="..\libgit2\include\git2\refdb.h" />
<ClInclude Include="..\libgit2\include\git2\reset.h" />
Expand Down Expand Up @@ -334,6 +339,7 @@
<ClInclude Include="..\libgit2\src\tree.h" />
<ClInclude Include="..\libgit2\src\util.h" />
<ClInclude Include="..\libgit2\src\vector.h" />
<ClInclude Include="..\libgit2\src\win32\buffer.h" />
<ClInclude Include="..\libgit2\src\win32\dir.h" />
<ClInclude Include="..\libgit2\src\win32\error.h" />
<ClInclude Include="..\libgit2\src\win32\findfile.h" />
Expand Down
9 changes: 6 additions & 3 deletions ext/build/libgit2.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,9 @@
<ClCompile Include="..\libgit2\src\win32\path_w32.c">
<Filter>Source Files\win32</Filter>
</ClCompile>
<ClCompile Include="..\libgit2\src\win32\buffer.c">
<Filter>Source Files\win32</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\libgit2\src\attr.h">
Expand Down Expand Up @@ -820,9 +823,6 @@
<ClInclude Include="..\libgit2\include\git2\message.h">
<Filter>Public Header Files</Filter>
</ClInclude>
<ClInclude Include="..\libgit2\include\git2\push.h">
<Filter>Public Header Files</Filter>
</ClInclude>
<ClInclude Include="..\libgit2\src\revwalk.h">
<Filter>Header Files</Filter>
</ClInclude>
Expand Down Expand Up @@ -1057,6 +1057,9 @@
<ClInclude Include="..\libgit2\src\integer.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\libgit2\src\win32\buffer.h">
<Filter>Header Files\win32</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="..\libgit2\src\win32\git2.rc">
Expand Down
2 changes: 1 addition & 1 deletion ext/libgit2
Submodule libgit2 updated 1734 files
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From 24dc594f617f754c6112ac014ab9cc4f2f86ef1d Mon Sep 17 00:00:00 2001
From d57a7c9e34150792203435405125b9ce0b54353f Mon Sep 17 00:00:00 2001
From: Sven Strickroth <email@cs-ware.de>
Date: Fri, 23 Jan 2015 14:16:34 +0100
Subject: [PATCH 1/6] core.autocrlf=true and core.safecrlf=true did not fail on
Subject: [PATCH 1/7] core.autocrlf=true and core.safecrlf=true did not fail on
LF-only file as vanilla git does

Reported-by: Yue Lin Ho <b8732003@student.nsysu.edu.tw>
Expand All @@ -14,10 +14,10 @@ Signed-off-by: Sven Strickroth <email@cs-ware.de>
4 files changed, 45 insertions(+), 6 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index b88488e..75ec09d 100644
index e140608..8fb39cd 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,6 +6,9 @@ v0.22 + 1
@@ -10,6 +10,9 @@ v0.22 + 1
* Updated binary identification in CRLF filtering to avoid false positives in
UTF-8 files.

Expand All @@ -28,7 +28,7 @@ index b88488e..75ec09d 100644

* Checkout can now handle an initial checkout of a repository, making
diff --git a/src/crlf.c b/src/crlf.c
index b5d1dbf..ba34c2b 100644
index f391137..3a3c937 100644
--- a/src/crlf.c
+++ b/src/crlf.c
@@ -138,8 +138,8 @@ static int crlf_apply_to_odb(
Expand All @@ -43,10 +43,10 @@ index b5d1dbf..ba34c2b 100644

/* If safecrlf is enabled, sanity-check the result. */
diff --git a/tests/filter/crlf.c b/tests/filter/crlf.c
index 406d3b6..969c3bd 100644
index a8ebd94..3490f1e 100644
--- a/tests/filter/crlf.c
+++ b/tests/filter/crlf.c
@@ -103,12 +103,12 @@ void test_filter_crlf__with_safecrlf(void)
@@ -99,12 +99,12 @@ void test_filter_crlf__with_safecrlf(void)
cl_git_fail(git_filter_list_apply_to_data(&out, fl, &in));
cl_assert_equal_i(giterr_last()->klass, GITERR_FILTER);

Expand Down Expand Up @@ -118,5 +118,5 @@ index 23f4793..803c141 100644
cl_git_mkfile("crlf/newfile.txt", ALL_CRLF_TEXT_RAW);
cl_git_pass(git_index_add_bypath(g_index, "newfile.txt"));
--
1.9.5.msysgit.1
1.8.1.2

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From 8a71a40b4392c3d888b9c47524a34cb38cb75803 Mon Sep 17 00:00:00 2001
From 3ce5aed4449b6e2dd9e4a11f4f306024d0fe8d02 Mon Sep 17 00:00:00 2001
From: Sven Strickroth <email@cs-ware.de>
Date: Fri, 23 Jan 2015 15:33:36 +0100
Subject: [PATCH 2/6] core.autocrlf is not correctly initialized on Win32 if
Subject: [PATCH 2/7] core.autocrlf is not correctly initialized on Win32 if
.gitattributes file exists and matches

Knowing the proper core.autocrlf value is need for deciding whether the CRLF filter needs to be executed...
Expand All @@ -12,10 +12,10 @@ Signed-off-by: Sven Strickroth <email@cs-ware.de>
1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/src/crlf.c b/src/crlf.c
index ba34c2b..9e03f20 100644
index 3a3c937..1290c01 100644
--- a/src/crlf.c
+++ b/src/crlf.c
@@ -267,6 +267,10 @@ static int crlf_check(
@@ -289,6 +289,10 @@ static int crlf_check(
ca.eol = check_eol(attr_values[1]); /* eol */
}
ca.auto_crlf = GIT_AUTO_CRLF_DEFAULT;
Expand All @@ -26,8 +26,8 @@ index ba34c2b..9e03f20 100644

/*
* Use the core Git logic to see if we should perform CRLF for this file
@@ -281,11 +285,6 @@ static int crlf_check(
(ca.crlf_action == GIT_CRLF_AUTO &&
@@ -303,11 +307,6 @@ static int crlf_check(
((ca.crlf_action == GIT_CRLF_AUTO || ca.crlf_action == GIT_CRLF_TEXT) &&
git_filter_source_mode(src) == GIT_FILTER_SMUDGE)) {

- error = git_repository__cvar(
Expand All @@ -39,5 +39,5 @@ index ba34c2b..9e03f20 100644
ca.auto_crlf == GIT_AUTO_CRLF_FALSE)
return GIT_PASSTHROUGH;
--
1.9.5.msysgit.1
1.8.1.2

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From 4c00f8a27b8db5f03290871f64d3d20aaac84ee4 Mon Sep 17 00:00:00 2001
From 16ebc13d93ed0433acadf7499a3834c7ba44d17f Mon Sep 17 00:00:00 2001
From: Sven Strickroth <email@cs-ware.de>
Date: Fri, 23 Jan 2015 15:34:14 +0100
Subject: [PATCH 3/6] Adding a CRLF-file with core.autocrlf=input and
Subject: [PATCH 3/7] Adding a CRLF-file with core.autocrlf=input and
core.safecrlf=true does not fail as with vanilla git

Signed-off-by: Sven Strickroth <email@cs-ware.de>
Expand All @@ -12,10 +12,10 @@ Signed-off-by: Sven Strickroth <email@cs-ware.de>
3 files changed, 20 insertions(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 75ec09d..0475da3 100644
index 8fb39cd..c31d921 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -8,6 +8,7 @@ v0.22 + 1
@@ -12,6 +12,7 @@ v0.22 + 1

* LF -> CRLF filter now correctly honors core.safecrlf=true errors
* LF only files were accepted with core.autocrlf=true on CRLF platforms
Expand All @@ -24,7 +24,7 @@ index 75ec09d..0475da3 100644
* Rename and copy detection is enabled for small files.

diff --git a/src/crlf.c b/src/crlf.c
index 9e03f20..c1e0b2b 100644
index 1290c01..29bbb5f 100644
--- a/src/crlf.c
+++ b/src/crlf.c
@@ -156,6 +156,19 @@ static int crlf_apply_to_odb(
Expand Down Expand Up @@ -72,5 +72,5 @@ index 803c141..38e7916 100644

void test_index_crlf__safecrlf_true_no_attrs(void)
--
1.9.5.msysgit.1
1.8.1.2

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From 1e98bdf76126d80e652a6ab152a8aa978c542594 Mon Sep 17 00:00:00 2001
From 2ff053f5e7d516ab1f62be2841ed6b5256ca81f7 Mon Sep 17 00:00:00 2001
From: Sven Strickroth <email@cs-ware.de>
Date: Fri, 23 Jan 2015 17:15:16 +0100
Subject: [PATCH 4/6] Make files with #CR!=#CRLF not fail with
Subject: [PATCH 4/7] Make files with #CR!=#CRLF not fail with
core.safecrlf=true

Signed-off-by: Sven Strickroth <email@cs-ware.de>
Expand All @@ -12,10 +12,10 @@ Signed-off-by: Sven Strickroth <email@cs-ware.de>
3 files changed, 17 insertions(+), 9 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0475da3..412839a 100644
index c31d921..d210632 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -9,6 +9,7 @@ v0.22 + 1
@@ -13,6 +13,7 @@ v0.22 + 1
* LF -> CRLF filter now correctly honors core.safecrlf=true errors
* LF only files were accepted with core.autocrlf=true on CRLF platforms
* files containig CRLF in combination with core.autocrlf=input were accepted
Expand All @@ -24,7 +24,7 @@ index 0475da3..412839a 100644
* Rename and copy detection is enabled for small files.

diff --git a/src/crlf.c b/src/crlf.c
index c1e0b2b..cf75086 100644
index 29bbb5f..2de107c 100644
--- a/src/crlf.c
+++ b/src/crlf.c
@@ -138,12 +138,20 @@ static int crlf_apply_to_odb(
Expand Down Expand Up @@ -65,10 +65,10 @@ index c1e0b2b..cf75086 100644
/*
* If the file in the index has any CR in it, do not convert.
diff --git a/tests/filter/crlf.c b/tests/filter/crlf.c
index 969c3bd..b81fbeb 100644
index 3490f1e..d1bf7a4 100644
--- a/tests/filter/crlf.c
+++ b/tests/filter/crlf.c
@@ -110,6 +110,13 @@ void test_filter_crlf__with_safecrlf(void)
@@ -106,6 +106,13 @@ void test_filter_crlf__with_safecrlf(void)
cl_git_fail(git_filter_list_apply_to_data(&out, fl, &in));
cl_assert_equal_i(giterr_last()->klass, GITERR_FILTER);

Expand All @@ -83,5 +83,5 @@ index 969c3bd..b81fbeb 100644
git_buf_free(&out);
}
--
1.9.5.msysgit.1
1.8.1.2

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From 9a8ca15dab6420866d69e3da1c280191a9efce4c Mon Sep 17 00:00:00 2001
From 354db3b141a352b08b6e59f6df4cccef13989d0e Mon Sep 17 00:00:00 2001
From: Sven Strickroth <email@cs-ware.de>
Date: Sun, 1 Feb 2015 13:39:31 +0100
Subject: [PATCH 5/6] Make CRLF filter behave like vanilla git for adding files
Subject: [PATCH 5/7] Make CRLF filter behave like vanilla git for adding files
in combination with attributes

Based on lots of manual testing (even with "malformed" files and binary) with vanilla git executable...
Expand All @@ -10,15 +10,15 @@ Signed-off-by: Sven Strickroth <email@cs-ware.de>
---
CHANGELOG.md | 5 +
src/crlf.c | 58 +--
tests/filter/crlf.h | 12 +
tests/filter/crlf.h | 18 +
tests/index/crlf.c | 1200 ++++++++++++++++++++++++++++++++++++++++++++++++++-
4 files changed, 1242 insertions(+), 33 deletions(-)
4 files changed, 1248 insertions(+), 33 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 412839a..881dca4 100644
index d210632..b22b497 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -11,6 +11,11 @@ v0.22 + 1
@@ -15,6 +15,11 @@ v0.22 + 1
* files containig CRLF in combination with core.autocrlf=input were accepted
* adding files containing CR and CRLF but not the same number failed

Expand All @@ -31,7 +31,7 @@ index 412839a..881dca4 100644

* Checkout can now handle an initial checkout of a repository, making
diff --git a/src/crlf.c b/src/crlf.c
index cf75086..eef8b5f 100644
index 2de107c..2507d2b 100644
--- a/src/crlf.c
+++ b/src/crlf.c
@@ -124,18 +124,21 @@ static int crlf_apply_to_odb(
Expand Down Expand Up @@ -138,13 +138,15 @@ index cf75086..eef8b5f 100644
return git_buf_text_crlf_to_lf(to, from);
}
diff --git a/tests/filter/crlf.h b/tests/filter/crlf.h
index 786edfc..0a7a10d 100644
index 786edfc..bb13162 100644
--- a/tests/filter/crlf.h
+++ b/tests/filter/crlf.h
@@ -11,16 +11,28 @@
@@ -11,16 +11,34 @@
#define ALL_LF_TEXT_RAW "lf\nlf\nlf\nlf\nlf\n"
#define MORE_CRLF_TEXT_RAW "crlf\r\ncrlf\r\nlf\ncrlf\r\ncrlf\r\n"
#define MORE_LF_TEXT_RAW "lf\nlf\ncrlf\r\nlf\nlf\n"
+#define MIXED_LF_CR_RAW "one\ntwo\rthree\nfour\r"
+#define MIXED_LF_CR_CRLF_RAW "one\ntwo\rthree\r\nfour\r"
+#define BINARY_ALL_CRLF_TEXT_RAW "\01one\r\ntwo\r\nthree\r\nfour\r\n"
+#define BINARY_ALL_LF_TEXT_RAW "\01one\ntwo\nthree\nfour\n"
+#define BINARY_MIXED_LF_CR_RAW "\01" MIXED_LF_CR_RAW
Expand All @@ -154,6 +156,8 @@ index 786edfc..0a7a10d 100644
#define ALL_LF_TEXT_AS_CRLF "lf\r\nlf\r\nlf\r\nlf\r\nlf\r\n"
#define MORE_CRLF_TEXT_AS_CRLF "crlf\r\ncrlf\r\nlf\r\ncrlf\r\ncrlf\r\n"
#define MORE_LF_TEXT_AS_CRLF "lf\r\nlf\r\ncrlf\r\nlf\r\nlf\r\n"
+#define MIXED_LF_CR_AS_CRLF "one\r\ntwo\rthree\r\nfour\r"
+#define MIXED_LF_CR_CRLF_AS_CRLF MIXED_LF_CR_AS_CRLF
+#define BINARY_ALL_CRLF_TEXT_AS_CRLF BINARY_ALL_CRLF_TEXT_RAW
+#define BINARY_ALL_LF_TEXT_AS_CRLF BINARY_ALL_CRLF_TEXT_AS_CRLF
+#define BINARY_MIXED_LF_CR_AS_CRLF "\01" MIXED_LF_CR_AS_CRLF
Expand All @@ -163,6 +167,8 @@ index 786edfc..0a7a10d 100644
#define ALL_LF_TEXT_AS_LF ALL_LF_TEXT_RAW
#define MORE_CRLF_TEXT_AS_LF "crlf\ncrlf\nlf\ncrlf\ncrlf\n"
#define MORE_LF_TEXT_AS_LF "lf\nlf\ncrlf\nlf\nlf\n"
+#define MIXED_LF_CR_AS_LF MIXED_LF_CR_RAW
+#define MIXED_LF_CR_CRLF_AS_LF MIXED_LF_CR_CRLF_RAW
+#define BINARY_ALL_CRLF_TEXT_AS_LF BINARY_ALL_CRLF_TEXT_RAW
+#define BINARY_ALL_LF_TEXT_AS_LF BINARY_ALL_LF_TEXT_RAW
+#define BINARY_MIXED_LF_CR_AS_LF BINARY_MIXED_LF_CR_RAW
Expand Down Expand Up @@ -1458,5 +1464,5 @@ index 38e7916..c9d2d84 100644
+ cl_assert_equal_oid(&oid, &entry->id);
}
--
1.9.5.msysgit.1
1.8.1.2

Loading

0 comments on commit e78b37f

Please sign in to comment.