summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEtienne Samson <samson.etienne@gmail.com>2018-03-26 18:44:13 +0000
committerEtienne Samson <samson.etienne@gmail.com>2018-03-26 21:02:16 +0200
commitcdd0bc2f878cc169b0c879f95156d6c356be07ba (patch)
tree72ffeb7ec464ad4fb77976e5820ed2c4a5d6326d
parent7bd129e4ecc98f2ed219cec6c13b2e9630c8801c (diff)
downloadlibgit2-cdd0bc2f878cc169b0c879f95156d6c356be07ba.tar.gz
checkout: change default strategy to SAFE
As per #4200, our default is quite surprising to users that expect checkout to just "do the thing".
-rw-r--r--CHANGELOG.md2
-rw-r--r--include/git2/checkout.h4
-rw-r--r--src/rebase.c3
-rw-r--r--src/stash.c3
4 files changed, 4 insertions, 8 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index ba0cb4ea8..d138d746e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -9,6 +9,8 @@ v0.27 + 1
### Breaking API changes
+* The default checkout strategy changed from `DRY_RUN` to `SAFE` (#4531).
+
v0.27
---------
diff --git a/include/git2/checkout.h b/include/git2/checkout.h
index 4a9dbb021..c7b0c83ef 100644
--- a/include/git2/checkout.h
+++ b/include/git2/checkout.h
@@ -251,7 +251,7 @@ typedef void (*git_checkout_perfdata_cb)(
typedef struct git_checkout_options {
unsigned int version;
- unsigned int checkout_strategy; /**< default will be a dry run */
+ unsigned int checkout_strategy; /**< default will be a safe checkout */
int disable_filters; /**< don't apply filters like CRLF conversion */
unsigned int dir_mode; /**< default is 0755 */
@@ -295,7 +295,7 @@ typedef struct git_checkout_options {
} git_checkout_options;
#define GIT_CHECKOUT_OPTIONS_VERSION 1
-#define GIT_CHECKOUT_OPTIONS_INIT {GIT_CHECKOUT_OPTIONS_VERSION}
+#define GIT_CHECKOUT_OPTIONS_INIT {GIT_CHECKOUT_OPTIONS_VERSION, GIT_CHECKOUT_SAFE}
/**
* Initializes a `git_checkout_options` with default values. Equivalent to
diff --git a/src/rebase.c b/src/rebase.c
index 3be751254..f1cb22f3f 100644
--- a/src/rebase.c
+++ b/src/rebase.c
@@ -275,9 +275,6 @@ static int rebase_alloc(git_rebase **out, const git_rebase_options *rebase_opts)
GITERR_CHECK_ALLOC(rebase->options.rewrite_notes_ref);
}
- if ((rebase->options.checkout_options.checkout_strategy & (GIT_CHECKOUT_SAFE | GIT_CHECKOUT_FORCE)) == 0)
- rebase->options.checkout_options.checkout_strategy = GIT_CHECKOUT_SAFE;
-
*out = rebase;
return 0;
diff --git a/src/stash.c b/src/stash.c
index 8a8c57a83..4b7e92af2 100644
--- a/src/stash.c
+++ b/src/stash.c
@@ -738,9 +738,6 @@ static void normalize_apply_options(
memcpy(opts, &default_apply_opts, sizeof(git_stash_apply_options));
}
- if ((opts->checkout_options.checkout_strategy & (GIT_CHECKOUT_SAFE | GIT_CHECKOUT_FORCE)) == 0)
- opts->checkout_options.checkout_strategy = GIT_CHECKOUT_SAFE;
-
if (!opts->checkout_options.our_label)
opts->checkout_options.our_label = "Updated upstream";