diff options
author | Edward Thomson <ethomson@microsoft.com> | 2015-02-19 11:32:55 -0500 |
---|---|---|
committer | Edward Thomson <ethomson@microsoft.com> | 2015-02-19 11:45:46 -0500 |
commit | 9c9aa1bad3b364f7dfdccd5f6abe880f7e18c499 (patch) | |
tree | c81adb6fae92593e5a9a872006d20ab8315bff62 | |
parent | d05218b06ff201cd373fc764e0d87af67f7932c7 (diff) | |
download | libgit2-9c9aa1bad3b364f7dfdccd5f6abe880f7e18c499.tar.gz |
filter: take `temp_buf` in `git_filter_options`
-rw-r--r-- | src/checkout.c | 5 | ||||
-rw-r--r-- | src/filter.c | 13 | ||||
-rw-r--r-- | src/filter.h | 4 |
3 files changed, 9 insertions, 13 deletions
diff --git a/src/checkout.c b/src/checkout.c index 2c47147e8..f71be26f9 100644 --- a/src/checkout.c +++ b/src/checkout.c @@ -1440,6 +1440,7 @@ static int blob_content_to_file( } filter_opts.attr_session = &data->attr_session; + filter_opts.temp_buf = &data->tmp; if (!data->opts.disable_filters && (error = git_filter_list__load_ext( @@ -1447,9 +1448,6 @@ static int blob_content_to_file( GIT_FILTER_TO_WORKTREE, &filter_opts))) return error; - if (fl) - git_filter_list__set_temp_buf(fl, &data->tmp); - /* setup the writer */ memset(&writer, 0, sizeof(struct checkout_stream)); writer.base.write = checkout_stream_write; @@ -2057,6 +2055,7 @@ static int checkout_write_merge( in_data.size = result.len; filter_opts.attr_session = &data->attr_session; + filter_opts.temp_buf = &data->tmp; if ((error = git_filter_list__load_ext( &fl, data->repo, NULL, git_buf_cstr(&path_workdir), diff --git a/src/filter.c b/src/filter.c index 646f1bc11..4fbf84f6a 100644 --- a/src/filter.c +++ b/src/filter.c @@ -517,8 +517,12 @@ int git_filter_list__load_ext( else if (error < 0) break; else { - if (!fl && (error = filter_list_new(&fl, &src)) < 0) - return error; + if (!fl) { + if ((error = filter_list_new(&fl, &src)) < 0) + return error; + + fl->temp_buf = filter_opts->temp_buf; + } fe = git_array_alloc(fl->filters); GITERR_CHECK_ALLOC(fe); @@ -553,11 +557,6 @@ int git_filter_list_load( filters, repo, blob, path, mode, &filter_opts); } -void git_filter_list__set_temp_buf(git_filter_list *fl, git_buf *temp_buf) -{ - fl->temp_buf = temp_buf; -} - void git_filter_list_free(git_filter_list *fl) { uint32_t i; diff --git a/src/filter.h b/src/filter.h index 85ef4a6f0..5062afba5 100644 --- a/src/filter.h +++ b/src/filter.h @@ -26,14 +26,12 @@ typedef enum { typedef struct { git_attr_session *attr_session; + git_buf *temp_buf; uint32_t flags; } git_filter_options; #define GIT_FILTER_OPTIONS_INIT {0} -extern void git_filter_list__set_temp_buf( - git_filter_list *fl, git_buf *temp_buf); - extern void git_filter_free(git_filter *filter); extern int git_filter_list__load_ext( |