Skip to content

Commit 217add9

Browse files
authored
Merge pull request libgit2#4531 from tiennou/fix/checkout-default-safe
checkout: change default strategy to SAFE
2 parents 7bd129e + cdd0bc2 commit 217add9

File tree

4 files changed

+4
-8
lines changed

4 files changed

+4
-8
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ v0.27 + 1
99

1010
### Breaking API changes
1111

12+
* The default checkout strategy changed from `DRY_RUN` to `SAFE` (#4531).
13+
1214
v0.27
1315
---------
1416

include/git2/checkout.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ typedef void (*git_checkout_perfdata_cb)(
251251
typedef struct git_checkout_options {
252252
unsigned int version;
253253

254-
unsigned int checkout_strategy; /**< default will be a dry run */
254+
unsigned int checkout_strategy; /**< default will be a safe checkout */
255255

256256
int disable_filters; /**< don't apply filters like CRLF conversion */
257257
unsigned int dir_mode; /**< default is 0755 */
@@ -295,7 +295,7 @@ typedef struct git_checkout_options {
295295
} git_checkout_options;
296296

297297
#define GIT_CHECKOUT_OPTIONS_VERSION 1
298-
#define GIT_CHECKOUT_OPTIONS_INIT {GIT_CHECKOUT_OPTIONS_VERSION}
298+
#define GIT_CHECKOUT_OPTIONS_INIT {GIT_CHECKOUT_OPTIONS_VERSION, GIT_CHECKOUT_SAFE}
299299

300300
/**
301301
* Initializes a `git_checkout_options` with default values. Equivalent to

src/rebase.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -275,9 +275,6 @@ static int rebase_alloc(git_rebase **out, const git_rebase_options *rebase_opts)
275275
GITERR_CHECK_ALLOC(rebase->options.rewrite_notes_ref);
276276
}
277277

278-
if ((rebase->options.checkout_options.checkout_strategy & (GIT_CHECKOUT_SAFE | GIT_CHECKOUT_FORCE)) == 0)
279-
rebase->options.checkout_options.checkout_strategy = GIT_CHECKOUT_SAFE;
280-
281278
*out = rebase;
282279

283280
return 0;

src/stash.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -738,9 +738,6 @@ static void normalize_apply_options(
738738
memcpy(opts, &default_apply_opts, sizeof(git_stash_apply_options));
739739
}
740740

741-
if ((opts->checkout_options.checkout_strategy & (GIT_CHECKOUT_SAFE | GIT_CHECKOUT_FORCE)) == 0)
742-
opts->checkout_options.checkout_strategy = GIT_CHECKOUT_SAFE;
743-
744741
if (!opts->checkout_options.our_label)
745742
opts->checkout_options.our_label = "Updated upstream";
746743

0 commit comments

Comments
 (0)