Commit 795eaccd667ce24c290b6211ca0c6a84f84e7c2b

Edward Thomson 2015-02-19T11:09:54

git_filter_opt_t -> git_filter_flag_t For consistency with the rest of the library, where an opt is an options *structure*.

diff --git a/include/git2/filter.h b/include/git2/filter.h
index c0aaf15..dc59e63 100644
--- a/include/git2/filter.h
+++ b/include/git2/filter.h
@@ -39,9 +39,9 @@ typedef enum {
  * Filter option flags.
  */
 typedef enum {
-	GIT_FILTER_OPT_DEFAULT = 0u,
-	GIT_FILTER_OPT_ALLOW_UNSAFE = (1u << 0),
-} git_filter_opt_t;
+	GIT_FILTER_DEFAULT = 0u,
+	GIT_FILTER_ALLOW_UNSAFE = (1u << 0),
+} git_filter_flag_t;
 
 /**
  * A filter that can transform file data
@@ -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 path Relative path of the file to be filtered
  * @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
  *         needed for the requested file), <0 on error
  */
@@ -93,7 +93,7 @@ GIT_EXTERN(int) git_filter_list_load(
 	git_blob *blob, /* can be NULL */
 	const char *path,
 	git_filter_mode_t mode,
-	uint32_t options);
+	uint32_t flags);
 
 /**
  * Apply filter list to a data buffer.
diff --git a/include/git2/sys/filter.h b/include/git2/sys/filter.h
index 9b560fa..5fd8d55 100644
--- a/include/git2/sys/filter.h
+++ b/include/git2/sys/filter.h
@@ -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);
 
 /**
- * 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
diff --git a/src/blob.c b/src/blob.c
index ba8769c..cf03290 100644
--- a/src/blob.c
+++ b/src/blob.c
@@ -199,7 +199,7 @@ int git_blob__create_from_paths(
 			/* Load the filters for writing this file to the ODB */
 			error = git_filter_list_load(
 				&fl, repo, NULL, hint_path,
-				GIT_FILTER_TO_ODB, GIT_FILTER_OPT_DEFAULT);
+				GIT_FILTER_TO_ODB, GIT_FILTER_DEFAULT);
 
 		if (error < 0)
 			/* well, that didn't work */;
@@ -357,7 +357,7 @@ int git_blob_filtered_content(
 
 	if (!(error = git_filter_list_load(
 			&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);
 
diff --git a/src/checkout.c b/src/checkout.c
index e48a855..a4dd209 100644
--- a/src/checkout.c
+++ b/src/checkout.c
@@ -1441,7 +1441,7 @@ static int blob_content_to_file(
 	if (!data->opts.disable_filters &&
 		(error = git_filter_list__load_with_attr_session(
 			&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;
 
 	if (fl)
@@ -2054,7 +2054,7 @@ static int checkout_write_merge(
 
 		if ((error = git_filter_list__load_with_attr_session(
 				&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)
 			goto done;
 	} else {
diff --git a/src/crlf.c b/src/crlf.c
index c0a7399..b5d1dbf 100644
--- a/src/crlf.c
+++ b/src/crlf.c
@@ -302,7 +302,7 @@ static int crlf_check(
 			return error;
 
 		/* 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_WARN;
 	}
diff --git a/src/diff.c b/src/diff.c
index 07eae03..815351b 100644
--- a/src/diff.c
+++ b/src/diff.c
@@ -600,7 +600,7 @@ int git_diff__oid_for_entry(
 		error = -1;
 	} else if (!(error = git_filter_list_load(
 		&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);
 		if (fd < 0)
diff --git a/src/diff_file.c b/src/diff_file.c
index 96be094..f7061ae 100644
--- a/src/diff_file.c
+++ b/src/diff_file.c
@@ -302,7 +302,7 @@ static int diff_file_content_load_workdir_file(
 
 	if ((error = git_filter_list_load(
 			&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;
 
 	/* if there are no filters, try to mmap the file */
diff --git a/src/filter.c b/src/filter.c
index 4009a61..88877fe 100644
--- a/src/filter.c
+++ b/src/filter.c
@@ -23,7 +23,7 @@ struct git_filter_source {
 	git_oid         oid;  /* zero if unknown (which is likely) */
 	uint16_t        filemode; /* zero if unknown */
 	git_filter_mode_t mode;
-	uint32_t        options;
+	uint32_t        flags;
 };
 
 typedef struct {
@@ -372,9 +372,9 @@ git_filter_mode_t git_filter_source_mode(const git_filter_source *src)
 	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(
@@ -394,7 +394,7 @@ static int filter_list_new(
 	fl->source.repo = src->repo;
 	fl->source.path = fl->path;
 	fl->source.mode = src->mode;
-	fl->source.options = src->options;
+	fl->source.flags = src->flags;
 
 	*out = fl;
 	return 0;
@@ -449,13 +449,13 @@ int git_filter_list_new(
 	git_filter_list **out,
 	git_repository *repo,
 	git_filter_mode_t mode,
-	uint32_t options)
+	uint32_t flags)
 {
 	git_filter_source src = { 0 };
 	src.repo = repo;
 	src.path = NULL;
 	src.mode = mode;
-	src.options = options;
+	src.flags = flags;
 	return filter_list_new(out, &src);
 }
 
@@ -466,7 +466,7 @@ int git_filter_list__load_with_attr_session(
 	git_blob *blob, /* can be NULL */
 	const char *path,
 	git_filter_mode_t mode,
-	uint32_t options)
+	uint32_t flags)
 {
 	int error = 0;
 	git_filter_list *fl = NULL;
@@ -481,7 +481,7 @@ int git_filter_list__load_with_attr_session(
 	src.repo = repo;
 	src.path = path;
 	src.mode = mode;
-	src.options = options;
+	src.flags = flags;
 	if (blob)
 		git_oid_cpy(&src.oid, git_blob_id(blob));
 
@@ -543,10 +543,10 @@ int git_filter_list_load(
 	git_blob *blob, /* can be NULL */
 	const char *path,
 	git_filter_mode_t mode,
-	uint32_t options)
+	uint32_t flags)
 {
 	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)
diff --git a/src/filter.h b/src/filter.h
index 53f3afd..a38c6c8 100644
--- a/src/filter.h
+++ b/src/filter.h
@@ -36,7 +36,7 @@ extern int git_filter_list__load_with_attr_session(
 	git_blob *blob, /* can be NULL */
 	const char *path,
 	git_filter_mode_t mode,
-	uint32_t options);
+	uint32_t flags);
 
 /*
  * Available filters
diff --git a/src/repository.c b/src/repository.c
index c927507..23c99b0 100644
--- a/src/repository.c
+++ b/src/repository.c
@@ -1849,7 +1849,7 @@ int git_repository_hashfile(
 	if (strlen(as_path) > 0) {
 		error = git_filter_list_load(
 			&fl, repo, NULL, as_path,
-			GIT_FILTER_TO_ODB, GIT_FILTER_OPT_DEFAULT);
+			GIT_FILTER_TO_ODB, GIT_FILTER_DEFAULT);
 		if (error < 0)
 			return error;
 	} else {
diff --git a/tests/filter/crlf.c b/tests/filter/crlf.c
index a31dac9..406d3b6 100644
--- a/tests/filter/crlf.c
+++ b/tests/filter/crlf.c
@@ -123,7 +123,7 @@ void test_filter_crlf__with_safecrlf_and_unsafe_allowed(void)
 	cl_repo_set_bool(g_repo, "core.safecrlf", true);
 
 	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);
 	cl_assert(crlf != NULL);