Commit c2418f461374a618504c261a4c71cdb01bab9f68

Carlos Martín Nieto 2015-06-25T12:48:44

Rename FALLBACK to UNSPECIFIED Fallback describes the mechanism, while unspecified explains what the user is thinking.

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 86f9955..49da917 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -242,7 +242,7 @@ support for HTTPS connections insead of OpenSSL.
   to fetch options which determine the runtime configuration.
 
 * The `git_remote_autotag_option_t` values have been changed. It has
-  gained a `_FALLBACK` default value to specify no override for the
+  gained a `_UNSPECIFIED` default value to specify no override for the
   configured setting.
 
 * `git_remote_update_tips()` now takes a pointer to the callbacks as
diff --git a/examples/status.c b/examples/status.c
index 8e242dd..49f006d 100644
--- a/examples/status.c
+++ b/examples/status.c
@@ -387,7 +387,7 @@ static void print_short(git_repository *repo, git_status_list *status)
 			unsigned int smstatus = 0;
 
 			if (!git_submodule_status(&smstatus, repo, s->index_to_workdir->new_file.path,
-						  GIT_SUBMODULE_IGNORE_FALLBACK)) {
+						  GIT_SUBMODULE_IGNORE_UNSPECIFIED)) {
 				if (smstatus & GIT_SUBMODULE_STATUS_WD_MODIFIED)
 					extra = " (new commits)";
 				else if (smstatus & GIT_SUBMODULE_STATUS_WD_INDEX_MODIFIED)
diff --git a/include/git2/diff.h b/include/git2/diff.h
index 90e2e1b..b3ab539 100644
--- a/include/git2/diff.h
+++ b/include/git2/diff.h
@@ -399,7 +399,7 @@ typedef struct {
  * `git_diff_options_init` programmatic initialization.
  */
 #define GIT_DIFF_OPTIONS_INIT \
-	{GIT_DIFF_OPTIONS_VERSION, 0, GIT_SUBMODULE_IGNORE_FALLBACK, {NULL,0}, NULL, NULL, 3}
+	{GIT_DIFF_OPTIONS_VERSION, 0, GIT_SUBMODULE_IGNORE_UNSPECIFIED, {NULL,0}, NULL, NULL, 3}
 
 /**
  * Initializes a `git_diff_options` with default values. Equivalent to
diff --git a/include/git2/remote.h b/include/git2/remote.h
index ccd0b43..e47f008 100644
--- a/include/git2/remote.h
+++ b/include/git2/remote.h
@@ -475,7 +475,7 @@ typedef enum {
 	/**
 	 * Use the setting from the configuration
 	 */
-	GIT_FETCH_PRUNE_FALLBACK,
+	GIT_FETCH_PRUNE_UNSPECIFIED,
 	/**
 	 * Force pruning on
 	 */
@@ -495,7 +495,7 @@ typedef enum {
 	/**
 	 * Use the setting from the configuration.
 	 */
-	GIT_REMOTE_DOWNLOAD_TAGS_FALLBACK = 0,
+	GIT_REMOTE_DOWNLOAD_TAGS_UNSPECIFIED = 0,
 	/**
 	 * Ask the server for tags pointing to objects we're already
 	 * downloading.
@@ -541,7 +541,7 @@ typedef struct {
 } git_fetch_options;
 
 #define GIT_FETCH_OPTIONS_VERSION 1
-#define GIT_FETCH_OPTIONS_INIT { GIT_FETCH_OPTIONS_VERSION, GIT_REMOTE_CALLBACKS_INIT, GIT_FETCH_PRUNE_FALLBACK, 1 }
+#define GIT_FETCH_OPTIONS_INIT { GIT_FETCH_OPTIONS_VERSION, GIT_REMOTE_CALLBACKS_INIT, GIT_FETCH_PRUNE_UNSPECIFIED, 1 }
 
 /**
  * Initializes a `git_fetch_options` with default values. Equivalent to
diff --git a/include/git2/types.h b/include/git2/types.h
index e975c60..6f41014 100644
--- a/include/git2/types.h
+++ b/include/git2/types.h
@@ -383,7 +383,7 @@ typedef enum {
  *
  * The values are:
  *
- * - GIT_SUBMODULE_IGNORE_FALLBACK: use the submodule's configuration
+ * - GIT_SUBMODULE_IGNORE_UNSPECIFIED: use the submodule's configuration
  * - GIT_SUBMODULE_IGNORE_NONE: don't ignore any change - i.e. even an
  *   untracked file, will mark the submodule as dirty.  Ignored files are
  *   still ignored, of course.
@@ -397,7 +397,7 @@ typedef enum {
  *   when we don't want any particular ignore rule to be specified.
  */
 typedef enum {
-	GIT_SUBMODULE_IGNORE_FALLBACK  = -1, /**< use the submodule's configuration */
+	GIT_SUBMODULE_IGNORE_UNSPECIFIED  = -1, /**< use the submodule's configuration */
 
 	GIT_SUBMODULE_IGNORE_NONE      = 1,  /**< any change or untracked == dirty */
 	GIT_SUBMODULE_IGNORE_UNTRACKED = 2,  /**< dirty if tracked files change */
diff --git a/src/checkout.c b/src/checkout.c
index 351e8b0..a94d509 100644
--- a/src/checkout.c
+++ b/src/checkout.c
@@ -180,7 +180,7 @@ static bool checkout_is_workdir_modified(
 			return true;
 		}
 
-		if (git_submodule_status(&sm_status, data->repo, wditem->path, GIT_SUBMODULE_IGNORE_FALLBACK) < 0 ||
+		if (git_submodule_status(&sm_status, data->repo, wditem->path, GIT_SUBMODULE_IGNORE_UNSPECIFIED) < 0 ||
 			GIT_SUBMODULE_STATUS_IS_WD_DIRTY(sm_status))
 			rval = true;
 		else if ((sm_oid = git_submodule_wd_id(sm)) == NULL)
diff --git a/src/diff_file.c b/src/diff_file.c
index 28edcd4..c603628 100644
--- a/src/diff_file.c
+++ b/src/diff_file.c
@@ -186,7 +186,7 @@ static int diff_file_content_commit_to_str(
 			return error;
 		}
 
-		if ((error = git_submodule_status(&sm_status, fc->repo, fc->file->path, GIT_SUBMODULE_IGNORE_FALLBACK)) < 0) {
+		if ((error = git_submodule_status(&sm_status, fc->repo, fc->file->path, GIT_SUBMODULE_IGNORE_UNSPECIFIED)) < 0) {
 			git_submodule_free(sm);
 			return error;
 		}
diff --git a/src/fetch.c b/src/fetch.c
index 82d86bb..4d89575 100644
--- a/src/fetch.c
+++ b/src/fetch.c
@@ -60,7 +60,7 @@ static int filter_wants(git_remote *remote, const git_fetch_options *opts)
 	size_t i, heads_len;
 	git_remote_autotag_option_t tagopt = remote->download_tags;
 
-	if (opts && opts->download_tags != GIT_REMOTE_DOWNLOAD_TAGS_FALLBACK)
+	if (opts && opts->download_tags != GIT_REMOTE_DOWNLOAD_TAGS_UNSPECIFIED)
 		tagopt = opts->download_tags;
 
 	git_vector_clear(&remote->refs);
diff --git a/src/remote.c b/src/remote.c
index 7c2d999..4dbcb3b 100644
--- a/src/remote.c
+++ b/src/remote.c
@@ -985,7 +985,7 @@ int git_remote_fetch(
 
 	if (opts && opts->prune == GIT_FETCH_PRUNE)
 		prune = true;
-	else if (opts && opts->prune == GIT_FETCH_PRUNE_FALLBACK && remote->prune_refs)
+	else if (opts && opts->prune == GIT_FETCH_PRUNE_UNSPECIFIED && remote->prune_refs)
 		prune = true;
 	else if (opts && opts->prune == GIT_FETCH_NO_PRUNE)
 		prune = false;
@@ -1539,7 +1539,7 @@ int git_remote_update_tips(
 	if ((error = ls_to_vector(&refs, remote)) < 0)
 		goto out;
 
-	if (download_tags == GIT_REMOTE_DOWNLOAD_TAGS_FALLBACK)
+	if (download_tags == GIT_REMOTE_DOWNLOAD_TAGS_UNSPECIFIED)
 		tagopt = remote->download_tags;
 	else
 		tagopt = download_tags;
diff --git a/src/submodule.c b/src/submodule.c
index 45163da..796364b 100644
--- a/src/submodule.c
+++ b/src/submodule.c
@@ -1030,7 +1030,7 @@ int git_submodule_update(git_submodule *sm, int init, git_submodule_update_optio
 	memcpy(&clone_options.fetch_opts, &update_options.fetch_opts, sizeof(git_fetch_options));
 
 	/* Get the status of the submodule to determine if it is already initialized  */
-	if ((error = git_submodule_status(&submodule_status, sm->repo, sm->name, GIT_SUBMODULE_IGNORE_FALLBACK)) < 0)
+	if ((error = git_submodule_status(&submodule_status, sm->repo, sm->name, GIT_SUBMODULE_IGNORE_UNSPECIFIED)) < 0)
 		goto done;
 
 	/*
@@ -1425,7 +1425,7 @@ int git_submodule__status(
 	unsigned int status;
 	git_repository *smrepo = NULL;
 
-	if (ign == GIT_SUBMODULE_IGNORE_FALLBACK)
+	if (ign == GIT_SUBMODULE_IGNORE_UNSPECIFIED)
 		ign = sm->ignore;
 
 	/* only return location info if ignore == all */
diff --git a/tests/diff/tree.c b/tests/diff/tree.c
index 977e21f..2bc9e6a 100644
--- a/tests/diff/tree.c
+++ b/tests/diff/tree.c
@@ -89,7 +89,7 @@ void test_diff_tree__0(void)
 }
 
 #define DIFF_OPTS(FLAGS, CTXT) \
-	{GIT_DIFF_OPTIONS_VERSION, (FLAGS), GIT_SUBMODULE_IGNORE_FALLBACK, \
+	{GIT_DIFF_OPTIONS_VERSION, (FLAGS), GIT_SUBMODULE_IGNORE_UNSPECIFIED, \
 	{NULL,0}, NULL, NULL, (CTXT), 1}
 
 void test_diff_tree__options(void)
diff --git a/tests/submodule/submodule_helpers.c b/tests/submodule/submodule_helpers.c
index 2647e15..1dc6872 100644
--- a/tests/submodule/submodule_helpers.c
+++ b/tests/submodule/submodule_helpers.c
@@ -167,7 +167,7 @@ unsigned int get_submodule_status(git_repository *repo, const char *name)
 
 	assert(repo && name);
 
-	cl_git_pass(git_submodule_status(&status, repo, name, GIT_SUBMODULE_IGNORE_FALLBACK));
+	cl_git_pass(git_submodule_status(&status, repo, name, GIT_SUBMODULE_IGNORE_UNSPECIFIED));
 
 	return status;
 }
diff --git a/tests/submodule/update.c b/tests/submodule/update.c
index fed6d38..40d24d0 100644
--- a/tests/submodule/update.c
+++ b/tests/submodule/update.c
@@ -103,7 +103,7 @@ void test_submodule_update__update_submodule(void)
 	cl_git_pass(git_submodule_lookup(&sm, g_repo, "testrepo"));
 
 	/* verify the initial state of the submodule */
-	cl_git_pass(git_submodule_status(&submodule_status, g_repo, "testrepo", GIT_SUBMODULE_IGNORE_FALLBACK));
+	cl_git_pass(git_submodule_status(&submodule_status, g_repo, "testrepo", GIT_SUBMODULE_IGNORE_UNSPECIFIED));
 	cl_assert_equal_i(submodule_status, GIT_SUBMODULE_STATUS_IN_HEAD |
 		GIT_SUBMODULE_STATUS_IN_INDEX |
 		GIT_SUBMODULE_STATUS_IN_CONFIG |
@@ -114,7 +114,7 @@ void test_submodule_update__update_submodule(void)
 	cl_git_pass(git_submodule_update(sm, 0, &update_options));
 
 	/* verify state */
-	cl_git_pass(git_submodule_status(&submodule_status, g_repo, "testrepo", GIT_SUBMODULE_IGNORE_FALLBACK));
+	cl_git_pass(git_submodule_status(&submodule_status, g_repo, "testrepo", GIT_SUBMODULE_IGNORE_UNSPECIFIED));
 	cl_assert_equal_i(submodule_status, GIT_SUBMODULE_STATUS_IN_HEAD |
 		GIT_SUBMODULE_STATUS_IN_INDEX |
 		GIT_SUBMODULE_STATUS_IN_CONFIG |
@@ -142,7 +142,7 @@ void test_submodule_update__update_and_init_submodule(void)
 	/* get the submodule */
 	cl_git_pass(git_submodule_lookup(&sm, g_repo, "testrepo"));
 
-	cl_git_pass(git_submodule_status(&submodule_status, g_repo, "testrepo", GIT_SUBMODULE_IGNORE_FALLBACK));
+	cl_git_pass(git_submodule_status(&submodule_status, g_repo, "testrepo", GIT_SUBMODULE_IGNORE_UNSPECIFIED));
 	cl_assert_equal_i(submodule_status, GIT_SUBMODULE_STATUS_IN_HEAD |
 		GIT_SUBMODULE_STATUS_IN_INDEX |
 		GIT_SUBMODULE_STATUS_IN_CONFIG |
@@ -177,7 +177,7 @@ void test_submodule_update__update_already_checked_out_submodule(void)
 	/* Initialize and update the sub repository */
 	cl_git_pass(git_submodule_lookup(&sm, g_repo, "testrepo"));
 
-	cl_git_pass(git_submodule_status(&submodule_status, g_repo, "testrepo", GIT_SUBMODULE_IGNORE_FALLBACK));
+	cl_git_pass(git_submodule_status(&submodule_status, g_repo, "testrepo", GIT_SUBMODULE_IGNORE_UNSPECIFIED));
 	cl_assert_equal_i(submodule_status, GIT_SUBMODULE_STATUS_IN_HEAD |
 		GIT_SUBMODULE_STATUS_IN_INDEX |
 		GIT_SUBMODULE_STATUS_IN_CONFIG |
@@ -203,7 +203,7 @@ void test_submodule_update__update_already_checked_out_submodule(void)
 	 * HEAD commit and index should be updated, but not the workdir.
 	 */
 
-	cl_git_pass(git_submodule_status(&submodule_status, g_repo, "testrepo", GIT_SUBMODULE_IGNORE_FALLBACK));
+	cl_git_pass(git_submodule_status(&submodule_status, g_repo, "testrepo", GIT_SUBMODULE_IGNORE_UNSPECIFIED));
 
 	git_submodule_free(sm);
 	cl_git_pass(git_submodule_lookup(&sm, g_repo, "testrepo"));
@@ -255,7 +255,7 @@ void test_submodule_update__update_blocks_on_dirty_wd(void)
 	/* Initialize and update the sub repository */
 	cl_git_pass(git_submodule_lookup(&sm, g_repo, "testrepo"));
 
-	cl_git_pass(git_submodule_status(&submodule_status, g_repo, "testrepo", GIT_SUBMODULE_IGNORE_FALLBACK));
+	cl_git_pass(git_submodule_status(&submodule_status, g_repo, "testrepo", GIT_SUBMODULE_IGNORE_UNSPECIFIED));
 	cl_assert_equal_i(submodule_status, GIT_SUBMODULE_STATUS_IN_HEAD |
 		GIT_SUBMODULE_STATUS_IN_INDEX |
 		GIT_SUBMODULE_STATUS_IN_CONFIG |
@@ -281,7 +281,7 @@ void test_submodule_update__update_blocks_on_dirty_wd(void)
 	 * HEAD commit and index should be updated, but not the workdir.
 	 */
 
-	cl_git_pass(git_submodule_status(&submodule_status, g_repo, "testrepo", GIT_SUBMODULE_IGNORE_FALLBACK));
+	cl_git_pass(git_submodule_status(&submodule_status, g_repo, "testrepo", GIT_SUBMODULE_IGNORE_UNSPECIFIED));
 
 	git_submodule_free(sm);
 	cl_git_pass(git_submodule_lookup(&sm, g_repo, "testrepo"));
@@ -332,7 +332,7 @@ void test_submodule_update__can_force_update(void)
 	/* Initialize and update the sub repository */
 	cl_git_pass(git_submodule_lookup(&sm, g_repo, "testrepo"));
 
-	cl_git_pass(git_submodule_status(&submodule_status, g_repo, "testrepo", GIT_SUBMODULE_IGNORE_FALLBACK));
+	cl_git_pass(git_submodule_status(&submodule_status, g_repo, "testrepo", GIT_SUBMODULE_IGNORE_UNSPECIFIED));
 	cl_assert_equal_i(submodule_status, GIT_SUBMODULE_STATUS_IN_HEAD |
 		GIT_SUBMODULE_STATUS_IN_INDEX |
 		GIT_SUBMODULE_STATUS_IN_CONFIG |
@@ -357,7 +357,7 @@ void test_submodule_update__can_force_update(void)
 	 * Verify state after checkout of parent repository. The submodule ID in the
 	 * HEAD commit and index should be updated, but not the workdir.
 	 */
-	cl_git_pass(git_submodule_status(&submodule_status, g_repo, "testrepo", GIT_SUBMODULE_IGNORE_FALLBACK));
+	cl_git_pass(git_submodule_status(&submodule_status, g_repo, "testrepo", GIT_SUBMODULE_IGNORE_UNSPECIFIED));
 
 	git_submodule_free(sm);
 	cl_git_pass(git_submodule_lookup(&sm, g_repo, "testrepo"));