Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2013-09-16 23:54:40 +0400
committerRussell Belfer <rb@github.com>2013-09-17 20:31:46 +0400
commiteefc32d54944ead5a5e3041c1b1f6c8c946cc014 (patch)
treee6d22bdf1655a37cbde72d192ca9c0d0bae6fa12 /src/crlf.c
parenteab3746b3026950ed62842c1e5641556d7131a5b (diff)
Bug fixes and cleanups
This contains a few bug fixes and some header and API cleanups. The main API change is that filters should now use GIT_PASSTHROUGH to indicate that they wish to skip processing a file instead of GIT_ENOTFOUND. The bug fixes include a possible out-of-range buffer access in the ident filter, a filter ordering problem I introduced into the custom filter tests on Windows, and a filter buf NUL termination issue that was coming up on Linux.
Diffstat (limited to 'src/crlf.c')
-rw-r--r--src/crlf.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/crlf.c b/src/crlf.c
index 6b1fe46a3..b4eda267b 100644
--- a/src/crlf.c
+++ b/src/crlf.c
@@ -143,7 +143,7 @@ static int crlf_apply_to_odb(
* stuff?
*/
if (stats.cr != stats.crlf)
- return GIT_ENOTFOUND;
+ return GIT_PASSTHROUGH;
if (ca->crlf_action == GIT_CRLF_GUESS) {
/*
@@ -151,11 +151,11 @@ static int crlf_apply_to_odb(
* This is the new safer autocrlf handling.
*/
if (has_cr_in_index(src))
- return GIT_ENOTFOUND;
+ return GIT_PASSTHROUGH;
}
if (!stats.cr)
- return GIT_ENOTFOUND;
+ return GIT_PASSTHROUGH;
}
/* Actually drop the carriage returns */
@@ -211,7 +211,7 @@ static int crlf_apply_to_workdir(
/* Don't filter binary files */
if (git_buf_text_is_binary(from))
- return GIT_ENOTFOUND;
+ return GIT_PASSTHROUGH;
/* Determine proper line ending */
workdir_ending = line_ending(ca);
@@ -220,10 +220,10 @@ static int crlf_apply_to_workdir(
if (!strcmp("\n", workdir_ending)) {
if (ca->crlf_action == GIT_CRLF_GUESS && ca->auto_crlf)
- return GIT_ENOTFOUND;
+ return GIT_PASSTHROUGH;
if (git_buf_find(from, '\r') < 0)
- return GIT_ENOTFOUND;
+ return GIT_PASSTHROUGH;
if (git_buf_text_crlf_to_lf(to, from) < 0)
return -1;
@@ -267,7 +267,7 @@ static int crlf_check(
ca.crlf_action = crlf_input_action(&ca);
if (ca.crlf_action == GIT_CRLF_BINARY)
- return GIT_ENOTFOUND;
+ return GIT_PASSTHROUGH;
if (ca.crlf_action == GIT_CRLF_GUESS) {
error = git_repository__cvar(
@@ -276,7 +276,7 @@ static int crlf_check(
return error;
if (ca.auto_crlf == GIT_AUTO_CRLF_FALSE)
- return GIT_ENOTFOUND;
+ return GIT_PASSTHROUGH;
}
*payload = git__malloc(sizeof(ca));
@@ -296,7 +296,7 @@ static int crlf_apply(
/* initialize payload in case `check` was bypassed */
if (!*payload) {
int error = crlf_check(self, payload, src, NULL);
- if (error < 0 && error != GIT_ENOTFOUND)
+ if (error < 0 && error != GIT_PASSTHROUGH)
return error;
}