filter: take temp_buf in git_filter_options

This commit is contained in:
Edward Thomson 2015-02-19 11:32:55 -05:00
parent d05218b06f
commit 9c9aa1bad3
3 changed files with 9 additions and 13 deletions

View File

@ -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),

View File

@ -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;

View File

@ -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(