Commit 795eaccd by Edward Thomson

git_filter_opt_t -> git_filter_flag_t

For consistency with the rest of the library, where an opt is an
options *structure*.
parent d4cf1675
...@@ -39,9 +39,9 @@ typedef enum { ...@@ -39,9 +39,9 @@ typedef enum {
* Filter option flags. * Filter option flags.
*/ */
typedef enum { typedef enum {
GIT_FILTER_OPT_DEFAULT = 0u, GIT_FILTER_DEFAULT = 0u,
GIT_FILTER_OPT_ALLOW_UNSAFE = (1u << 0), GIT_FILTER_ALLOW_UNSAFE = (1u << 0),
} git_filter_opt_t; } git_filter_flag_t;
/** /**
* A filter that can transform file data * A filter that can transform file data
...@@ -83,7 +83,7 @@ typedef struct git_filter_list git_filter_list; ...@@ -83,7 +83,7 @@ typedef struct git_filter_list git_filter_list;
* @param blob The blob to which the filter will be applied (if known) * @param blob The blob to which the filter will be applied (if known)
* @param path Relative path of the file to be filtered * @param path Relative path of the file to be filtered
* @param mode Filtering direction (WT->ODB or ODB->WT) * @param mode Filtering direction (WT->ODB or ODB->WT)
* @param options Combination of `git_filter_opt_t` flags * @param flags Combination of `git_filter_flag_t` flags
* @return 0 on success (which could still return NULL if no filters are * @return 0 on success (which could still return NULL if no filters are
* needed for the requested file), <0 on error * needed for the requested file), <0 on error
*/ */
...@@ -93,7 +93,7 @@ GIT_EXTERN(int) git_filter_list_load( ...@@ -93,7 +93,7 @@ GIT_EXTERN(int) git_filter_list_load(
git_blob *blob, /* can be NULL */ git_blob *blob, /* can be NULL */
const char *path, const char *path,
git_filter_mode_t mode, git_filter_mode_t mode,
uint32_t options); uint32_t flags);
/** /**
* Apply filter list to a data buffer. * Apply filter list to a data buffer.
......
...@@ -123,9 +123,9 @@ GIT_EXTERN(const git_oid *) git_filter_source_id(const git_filter_source *src); ...@@ -123,9 +123,9 @@ GIT_EXTERN(const git_oid *) git_filter_source_id(const git_filter_source *src);
GIT_EXTERN(git_filter_mode_t) git_filter_source_mode(const git_filter_source *src); GIT_EXTERN(git_filter_mode_t) git_filter_source_mode(const git_filter_source *src);
/** /**
* Get the combination git_filter_opt_t options to be applied * Get the combination git_filter_flag_t options to be applied
*/ */
GIT_EXTERN(uint32_t) git_filter_source_options(const git_filter_source *src); GIT_EXTERN(uint32_t) git_filter_source_flags(const git_filter_source *src);
/* /*
* struct git_filter * struct git_filter
......
...@@ -199,7 +199,7 @@ int git_blob__create_from_paths( ...@@ -199,7 +199,7 @@ int git_blob__create_from_paths(
/* Load the filters for writing this file to the ODB */ /* Load the filters for writing this file to the ODB */
error = git_filter_list_load( error = git_filter_list_load(
&fl, repo, NULL, hint_path, &fl, repo, NULL, hint_path,
GIT_FILTER_TO_ODB, GIT_FILTER_OPT_DEFAULT); GIT_FILTER_TO_ODB, GIT_FILTER_DEFAULT);
if (error < 0) if (error < 0)
/* well, that didn't work */; /* well, that didn't work */;
...@@ -357,7 +357,7 @@ int git_blob_filtered_content( ...@@ -357,7 +357,7 @@ int git_blob_filtered_content(
if (!(error = git_filter_list_load( if (!(error = git_filter_list_load(
&fl, git_blob_owner(blob), blob, path, &fl, git_blob_owner(blob), blob, path,
GIT_FILTER_TO_WORKTREE, GIT_FILTER_OPT_DEFAULT))) { GIT_FILTER_TO_WORKTREE, GIT_FILTER_DEFAULT))) {
error = git_filter_list_apply_to_blob(out, fl, blob); error = git_filter_list_apply_to_blob(out, fl, blob);
......
...@@ -1441,7 +1441,7 @@ static int blob_content_to_file( ...@@ -1441,7 +1441,7 @@ static int blob_content_to_file(
if (!data->opts.disable_filters && if (!data->opts.disable_filters &&
(error = git_filter_list__load_with_attr_session( (error = git_filter_list__load_with_attr_session(
&fl, data->repo, &data->attr_session, blob, hint_path, &fl, data->repo, &data->attr_session, blob, hint_path,
GIT_FILTER_TO_WORKTREE, GIT_FILTER_OPT_DEFAULT))) GIT_FILTER_TO_WORKTREE, GIT_FILTER_DEFAULT)))
return error; return error;
if (fl) if (fl)
...@@ -2054,7 +2054,7 @@ static int checkout_write_merge( ...@@ -2054,7 +2054,7 @@ static int checkout_write_merge(
if ((error = git_filter_list__load_with_attr_session( if ((error = git_filter_list__load_with_attr_session(
&fl, data->repo, &data->attr_session, NULL, git_buf_cstr(&path_workdir), &fl, data->repo, &data->attr_session, NULL, git_buf_cstr(&path_workdir),
GIT_FILTER_TO_WORKTREE, GIT_FILTER_OPT_DEFAULT)) < 0 || GIT_FILTER_TO_WORKTREE, GIT_FILTER_DEFAULT)) < 0 ||
(error = git_filter_list_apply_to_data(&out_data, fl, &in_data)) < 0) (error = git_filter_list_apply_to_data(&out_data, fl, &in_data)) < 0)
goto done; goto done;
} else { } else {
......
...@@ -302,7 +302,7 @@ static int crlf_check( ...@@ -302,7 +302,7 @@ static int crlf_check(
return error; return error;
/* downgrade FAIL to WARN if ALLOW_UNSAFE option is used */ /* downgrade FAIL to WARN if ALLOW_UNSAFE option is used */
if ((git_filter_source_options(src) & GIT_FILTER_OPT_ALLOW_UNSAFE) && if ((git_filter_source_flags(src) & GIT_FILTER_ALLOW_UNSAFE) &&
ca.safe_crlf == GIT_SAFE_CRLF_FAIL) ca.safe_crlf == GIT_SAFE_CRLF_FAIL)
ca.safe_crlf = GIT_SAFE_CRLF_WARN; ca.safe_crlf = GIT_SAFE_CRLF_WARN;
} }
......
...@@ -600,7 +600,7 @@ int git_diff__oid_for_entry( ...@@ -600,7 +600,7 @@ int git_diff__oid_for_entry(
error = -1; error = -1;
} else if (!(error = git_filter_list_load( } else if (!(error = git_filter_list_load(
&fl, diff->repo, NULL, entry.path, &fl, diff->repo, NULL, entry.path,
GIT_FILTER_TO_ODB, GIT_FILTER_OPT_ALLOW_UNSAFE))) GIT_FILTER_TO_ODB, GIT_FILTER_ALLOW_UNSAFE)))
{ {
int fd = git_futils_open_ro(full_path.ptr); int fd = git_futils_open_ro(full_path.ptr);
if (fd < 0) if (fd < 0)
......
...@@ -302,7 +302,7 @@ static int diff_file_content_load_workdir_file( ...@@ -302,7 +302,7 @@ static int diff_file_content_load_workdir_file(
if ((error = git_filter_list_load( if ((error = git_filter_list_load(
&fl, fc->repo, NULL, fc->file->path, &fl, fc->repo, NULL, fc->file->path,
GIT_FILTER_TO_ODB, GIT_FILTER_OPT_ALLOW_UNSAFE)) < 0) GIT_FILTER_TO_ODB, GIT_FILTER_ALLOW_UNSAFE)) < 0)
goto cleanup; goto cleanup;
/* if there are no filters, try to mmap the file */ /* if there are no filters, try to mmap the file */
......
...@@ -23,7 +23,7 @@ struct git_filter_source { ...@@ -23,7 +23,7 @@ struct git_filter_source {
git_oid oid; /* zero if unknown (which is likely) */ git_oid oid; /* zero if unknown (which is likely) */
uint16_t filemode; /* zero if unknown */ uint16_t filemode; /* zero if unknown */
git_filter_mode_t mode; git_filter_mode_t mode;
uint32_t options; uint32_t flags;
}; };
typedef struct { typedef struct {
...@@ -372,9 +372,9 @@ git_filter_mode_t git_filter_source_mode(const git_filter_source *src) ...@@ -372,9 +372,9 @@ git_filter_mode_t git_filter_source_mode(const git_filter_source *src)
return src->mode; return src->mode;
} }
uint32_t git_filter_source_options(const git_filter_source *src) uint32_t git_filter_source_flags(const git_filter_source *src)
{ {
return src->options; return src->flags;
} }
static int filter_list_new( static int filter_list_new(
...@@ -394,7 +394,7 @@ static int filter_list_new( ...@@ -394,7 +394,7 @@ static int filter_list_new(
fl->source.repo = src->repo; fl->source.repo = src->repo;
fl->source.path = fl->path; fl->source.path = fl->path;
fl->source.mode = src->mode; fl->source.mode = src->mode;
fl->source.options = src->options; fl->source.flags = src->flags;
*out = fl; *out = fl;
return 0; return 0;
...@@ -449,13 +449,13 @@ int git_filter_list_new( ...@@ -449,13 +449,13 @@ int git_filter_list_new(
git_filter_list **out, git_filter_list **out,
git_repository *repo, git_repository *repo,
git_filter_mode_t mode, git_filter_mode_t mode,
uint32_t options) uint32_t flags)
{ {
git_filter_source src = { 0 }; git_filter_source src = { 0 };
src.repo = repo; src.repo = repo;
src.path = NULL; src.path = NULL;
src.mode = mode; src.mode = mode;
src.options = options; src.flags = flags;
return filter_list_new(out, &src); return filter_list_new(out, &src);
} }
...@@ -466,7 +466,7 @@ int git_filter_list__load_with_attr_session( ...@@ -466,7 +466,7 @@ int git_filter_list__load_with_attr_session(
git_blob *blob, /* can be NULL */ git_blob *blob, /* can be NULL */
const char *path, const char *path,
git_filter_mode_t mode, git_filter_mode_t mode,
uint32_t options) uint32_t flags)
{ {
int error = 0; int error = 0;
git_filter_list *fl = NULL; git_filter_list *fl = NULL;
...@@ -481,7 +481,7 @@ int git_filter_list__load_with_attr_session( ...@@ -481,7 +481,7 @@ int git_filter_list__load_with_attr_session(
src.repo = repo; src.repo = repo;
src.path = path; src.path = path;
src.mode = mode; src.mode = mode;
src.options = options; src.flags = flags;
if (blob) if (blob)
git_oid_cpy(&src.oid, git_blob_id(blob)); git_oid_cpy(&src.oid, git_blob_id(blob));
...@@ -543,10 +543,10 @@ int git_filter_list_load( ...@@ -543,10 +543,10 @@ int git_filter_list_load(
git_blob *blob, /* can be NULL */ git_blob *blob, /* can be NULL */
const char *path, const char *path,
git_filter_mode_t mode, git_filter_mode_t mode,
uint32_t options) uint32_t flags)
{ {
return git_filter_list__load_with_attr_session( return git_filter_list__load_with_attr_session(
filters, repo, NULL, blob, path, mode, options); filters, repo, NULL, blob, path, mode, flags);
} }
void git_filter_list__set_temp_buf(git_filter_list *fl, git_buf *temp_buf) void git_filter_list__set_temp_buf(git_filter_list *fl, git_buf *temp_buf)
......
...@@ -36,7 +36,7 @@ extern int git_filter_list__load_with_attr_session( ...@@ -36,7 +36,7 @@ extern int git_filter_list__load_with_attr_session(
git_blob *blob, /* can be NULL */ git_blob *blob, /* can be NULL */
const char *path, const char *path,
git_filter_mode_t mode, git_filter_mode_t mode,
uint32_t options); uint32_t flags);
/* /*
* Available filters * Available filters
......
...@@ -1849,7 +1849,7 @@ int git_repository_hashfile( ...@@ -1849,7 +1849,7 @@ int git_repository_hashfile(
if (strlen(as_path) > 0) { if (strlen(as_path) > 0) {
error = git_filter_list_load( error = git_filter_list_load(
&fl, repo, NULL, as_path, &fl, repo, NULL, as_path,
GIT_FILTER_TO_ODB, GIT_FILTER_OPT_DEFAULT); GIT_FILTER_TO_ODB, GIT_FILTER_DEFAULT);
if (error < 0) if (error < 0)
return error; return error;
} else { } else {
......
...@@ -123,7 +123,7 @@ void test_filter_crlf__with_safecrlf_and_unsafe_allowed(void) ...@@ -123,7 +123,7 @@ void test_filter_crlf__with_safecrlf_and_unsafe_allowed(void)
cl_repo_set_bool(g_repo, "core.safecrlf", true); cl_repo_set_bool(g_repo, "core.safecrlf", true);
cl_git_pass(git_filter_list_new( cl_git_pass(git_filter_list_new(
&fl, g_repo, GIT_FILTER_TO_ODB, GIT_FILTER_OPT_ALLOW_UNSAFE)); &fl, g_repo, GIT_FILTER_TO_ODB, GIT_FILTER_ALLOW_UNSAFE));
crlf = git_filter_lookup(GIT_FILTER_CRLF); crlf = git_filter_lookup(GIT_FILTER_CRLF);
cl_assert(crlf != NULL); cl_assert(crlf != NULL);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment