10000 checkout: deprecate GIT_CHECKOUT_NONE · libgit2/libgit2@09a51af · GitHub
[go: up one dir, main page]

Skip to content

Commit 09a51af

Browse files
committed
checkout: deprecate GIT_CHECKOUT_NONE
`GIT_CHECKOUT_NONE` makes little sense. Users should prefer `DRY_RUN`, and `NONE` should be deprecated.
1 parent 2a827f8 commit 09a51af

File tree

3 files changed

+19
-7
lines changed

3 files changed

+19
-7
lines changed

include/git2/checkout.h

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -190,13 +190,8 @@ typedef enum {
190190
/** Recursively checkout submodules if HEAD moved in super repo (NOT IMPLEMENTED) */
191191
GIT_CHECKOUT_UPDATE_SUBMODULES_IF_CHANGED = (1u << 17),
192192

193-
/**
194-
* Do not do a checkout and do not fire callbacks; this is useful
195-
* for internal functions that will perform the checkout themselves
196-
* but need to pass checkout options into another function, for
197-
* example, `git_clone`.
198-
*/
199-
GIT_CHECKOUT_NONE = (1u << 30)
193+
/** Reserved for backward compatibility */
194+
GIT_CHECKOUT_RESERVED = (1u << 30)
200195
} git_checkout_strategy_t;
201196

202197
/**

include/git2/deprecated.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,21 @@ GIT_EXTERN(void) git_buf_free(git_buf *buffer);
260260

261261
/**@}*/
262262

263+
/** @name Deprecated Checkout Definitions */
264+
/**@{*/
265+
266+
/**
267+
* Do not do a checkout and do not fire callbacks; this is useful
268+
* for internal functions that will perform the checkout themselves
269+
* but need to pass checkout options into another function, for
270+
* example, `git_clone`.
271+
*
272+
* @deprecated Users should use `GIT_CHECKOUT_DRY_RUN`
273+
*/
274+
#define GIT_CHECKOUT_NONE (1u << 30)
275+
276+
/**@}*/
277+
263278
/** @name Deprecated Commit Definitions
264279
*/
265280
/**@{*/

src/libgit2/clone.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -583,8 +583,10 @@ static int clone_repo(
583583
options.fetch_opts.download_tags = GIT_REMOTE_DOWNLOAD_TAGS_ALL;
584584

585585
/* Backward compatibility: support the deprecated GIT_CHECKOUT_NONE */
586+
#ifndef GIT_DEPRECATE_HARD
586587
if (options.checkout_opts.checkout_strategy == GIT_CHECKOUT_NONE)
587588
options.no_checkout = 1;
589+
#endif
588590

589591
/* Only clone to a new directory or an empty directory */
590592
if (git_fs_path_exists(local_path) && !use_existing && !git_fs_path_is_empty_dir(local_path)) {

0 commit comments

Comments
 (0)
0