Commit 567fd782d92e0e55724e93931faf28005d71904e

Josh Leeb-du Toit 2016-09-26T19:32:15

Remove `clone_checkout_strategy` in submodule update opts Remove `clone_checkout_strategy` in `git_submodule_update_options` as per issue #3784.

diff --git a/CHANGELOG.md b/CHANGELOG.md
index dae86de..1c5644b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -61,6 +61,10 @@ v0.24 + 1
 * `git_blob_create_fromchunks()` has been removed in favour of
   `git_blob_create_fromstream()`.
 
+* `clone_checkout_strategy` has been removed from
+  `git_submodule_update_option` as it is no longer necessary after
+  removing the `GIT_CHECKOUT_SAFE_CREATE` flag in favour of the 'GIT_CHECKOUT_SAFE' flag.
+
 ### Breaking API changes
 
 * `git_packbuilder_object_count` and `git_packbuilder_written` now
diff --git a/include/git2/submodule.h b/include/git2/submodule.h
index 540ecf5..ab5d7b6 100644
--- a/include/git2/submodule.h
+++ b/include/git2/submodule.h
@@ -134,9 +134,7 @@ typedef struct git_submodule_update_options {
 	 * checkout, set the `checkout_strategy` to
 	 * `GIT_CHECKOUT_NONE`. Generally you will want the use
 	 * GIT_CHECKOUT_SAFE to update files in the working
-	 * directory. Use the `clone_checkout_strategy` field
-	 * to set the checkout strategy that will be used in
-	 * the case where update needs to clone the repository.
+	 * directory. 
 	 */
 	git_checkout_options checkout_opts;
 
@@ -149,13 +147,6 @@ typedef struct git_submodule_update_options {
 	git_fetch_options fetch_opts;
 
 	/**
-	 * The checkout strategy to use when the sub repository needs to
-	 * be cloned. Use GIT_CHECKOUT_SAFE to create all files
-	 * in the working directory for the newly cloned repository.
-	 */
-	unsigned int clone_checkout_strategy;
-
-	/**
 	 * Allow fetching from the submodule's default remote if the target
 	 * commit isn't found. Enabled by default.
 	 */
@@ -166,7 +157,7 @@ typedef struct git_submodule_update_options {
 #define GIT_SUBMODULE_UPDATE_OPTIONS_INIT \
 	{ GIT_SUBMODULE_UPDATE_OPTIONS_VERSION, \
 		{ GIT_CHECKOUT_OPTIONS_VERSION, GIT_CHECKOUT_SAFE }, \
-	GIT_FETCH_OPTIONS_INIT, GIT_CHECKOUT_SAFE, 1 }
+	GIT_FETCH_OPTIONS_INIT, GIT_CHECKOUT_SAFE }
 
 /**
  * Initializes a `git_submodule_update_options` with default values.
diff --git a/src/submodule.c b/src/submodule.c
index 86ad53b..0175ac5 100644
--- a/src/submodule.c
+++ b/src/submodule.c
@@ -1160,7 +1160,7 @@ int git_submodule_update(git_submodule *sm, int init, git_submodule_update_optio
 		 * will checkout the specific commit manually.
 		 */
 		clone_options.checkout_opts.checkout_strategy = GIT_CHECKOUT_NONE;
-		update_options.checkout_opts.checkout_strategy = update_options.clone_checkout_strategy;
+		update_options.checkout_opts.checkout_strategy = GIT_CHECKOUT_SAFE;
 
 		if ((error = git_clone(&sub_repo, submodule_url, sm->path, &clone_options)) < 0 ||
 			(error = git_repository_set_head_detached(sub_repo, git_submodule_index_id(sm))) < 0 ||