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:
authorVicent Martí <tanoku@gmail.com>2012-03-01 08:06:47 +0400
committerVicent Martí <tanoku@gmail.com>2012-03-01 08:06:47 +0400
commit788430c8e3fa90dd965b44fb31ba8b2eece2ca37 (patch)
treee853a2864add03e28839bd3fcf25a133a16f2c70 /src/filter.c
parentc5266ebac5d9753029f8b10598862cb2b7e13b55 (diff)
filter: Properly cache filter settings
Diffstat (limited to 'src/filter.c')
-rw-r--r--src/filter.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/filter.c b/src/filter.c
index 03189eea3..f517512dd 100644
--- a/src/filter.c
+++ b/src/filter.c
@@ -87,9 +87,11 @@ int git_text__is_binary(git_text_stats *stats)
int git_filter__load_for_file(git_vector *filters, git_repository *repo, const char *path, int mode)
{
int error;
- git_filter *crlf_filter;
+ git_filter *crlf_filter = NULL;
- return 0; /* TODO: not quite ready yet */
+ error = git_filter__load_settings(repo);
+ if (error < GIT_SUCCESS)
+ return error;
if (mode == GIT_FILTER_TO_ODB) {
error = git_filter__crlf_to_odb(&crlf_filter, repo, path);
@@ -183,6 +185,9 @@ int git_filter__load_settings(git_repository *repo)
git_config *config;
int error;
+ if (repo->filter_options.loaded)
+ return GIT_SUCCESS;
+
repo->filter_options.eol = GIT_EOL_DEFAULT;
repo->filter_options.auto_crlf = GIT_AUTO_CRLF_DEFAULT;
@@ -202,5 +207,6 @@ int git_filter__load_settings(git_repository *repo)
if (error < GIT_SUCCESS && error != GIT_ENOTFOUND)
return error;
+ repo->filter_options.loaded = 1;
return 0;
}