Fix possible resource leak
[TortoiseGit.git] / ext / libgit2-0002-core.autocrlf-is-not-correctly-initialized-on-Win32-.patch
blob1f66f2d98d348236a08974f986a461e6db8c0597
1 From deb8c3f59e349d0df5870111dea1a70e7a9ce511 Mon Sep 17 00:00:00 2001
2 From: Sven Strickroth <email@cs-ware.de>
3 Date: Fri, 23 Jan 2015 15:33:36 +0100
4 Subject: [PATCH 2/7] core.autocrlf is not correctly initialized on Win32 if
5 .gitattributes file exists and matches
7 Knowing the proper core.autocrlf value is need for deciding whether the CRLF filter needs to be executed...
9 Signed-off-by: Sven Strickroth <email@cs-ware.de>
10 ---
11 src/crlf.c | 9 ++++-----
12 1 file changed, 4 insertions(+), 5 deletions(-)
14 diff --git a/src/crlf.c b/src/crlf.c
15 index 62b4d6a38..c1f87485e 100644
16 --- a/src/crlf.c
17 +++ b/src/crlf.c
18 @@ -294,6 +294,10 @@ static int crlf_check(
19 ca.eol = check_eol(attr_values[1]); /* eol */
21 ca.auto_crlf = GIT_AUTO_CRLF_DEFAULT;
22 + error = git_repository__cvar(
23 + &ca.auto_crlf, git_filter_source_repo(src), GIT_CVAR_AUTO_CRLF);
24 + if (error < 0)
25 + return error;
26 ca.safe_crlf = GIT_SAFE_CRLF_DEFAULT;
29 @@ -310,11 +314,6 @@ static int crlf_check(
30 ca.crlf_action == GIT_CRLF_TEXT) &&
31 git_filter_source_mode(src) == GIT_FILTER_SMUDGE)) {
33 - error = git_repository__cvar(
34 - &ca.auto_crlf, git_filter_source_repo(src), GIT_CVAR_AUTO_CRLF);
35 - if (error < 0)
36 - return error;
38 if (ca.crlf_action == GIT_CRLF_GUESS &&
39 ca.auto_crlf == GIT_AUTO_CRLF_FALSE)
40 return GIT_PASSTHROUGH;
41 --
42 2.16.1.windows.4