Skip to content

Commit 1ab0523

Browse files
authored
Merge pull request libgit2#5101 from libgit2/ethomson/opts_init
Rename options initialization functions
2 parents bed33a6 + c0dd712 commit 1ab0523

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+297
-100
lines changed

examples/describe.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ static void do_describe_single(git_repository *repo, describe_options *opts, con
6363
git_object *commit;
6464
git_describe_result *describe_result;
6565
git_buf buf = { 0 };
66-
66+
6767
if (rev) {
6868
check_lg2(git_revparse_single(&commit, repo, rev),
6969
"Failed to lookup rev", rev);
@@ -148,8 +148,8 @@ static void describe_options_init(describe_options *opts)
148148

149149
opts->commits = NULL;
150150
opts->commit_count = 0;
151-
git_describe_init_options(&opts->describe_options, GIT_DESCRIBE_OPTIONS_VERSION);
152-
git_describe_init_format_options(&opts->format_options, GIT_DESCRIBE_FORMAT_OPTIONS_VERSION);
151+
git_describe_options_init(&opts->describe_options, GIT_DESCRIBE_OPTIONS_VERSION);
152+
git_describe_format_options_init(&opts->format_options, GIT_DESCRIBE_FORMAT_OPTIONS_VERSION);
153153
}
154154

155155
int lg2_describe(git_repository *repo, int argc, char **argv)

include/git2/apply.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ typedef int GIT_CALLBACK(git_apply_hunk_cb)(
5757
* Apply options structure
5858
*
5959
* Initialize with `GIT_APPLY_OPTIONS_INIT`. Alternatively, you can
60-
* use `git_apply_init_options`.
60+
* use `git_apply_options_init`.
6161
*
6262
* @see git_apply_to_tree, git_apply
6363
*/
@@ -72,6 +72,8 @@ typedef struct {
7272
#define GIT_APPLY_OPTIONS_VERSION 1
7373
#define GIT_APPLY_OPTIONS_INIT {GIT_APPLY_OPTIONS_VERSION}
7474

75+
GIT_EXTERN(int) git_apply_options_init(git_apply_options *opts, unsigned int version);
76+
7577
/**
7678
* Apply a `git_diff` to a `git_tree`, and return the resulting image
7779
* as an index.

include/git2/blame.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ typedef enum {
5353
* Blame options structure
5454
*
5555
* Initialize with `GIT_BLAME_OPTIONS_INIT`. Alternatively, you can
56-
* use `git_blame_init_options`.
56+
* use `git_blame_options_init`.
5757
*
5858
*/
5959
typedef struct git_blame_options {
@@ -100,7 +100,7 @@ typedef struct git_blame_options {
100100
* @param version The struct version; pass `GIT_BLAME_OPTIONS_VERSION`.
101101
* @return Zero on success; -1 on failure.
102102
*/
103-
GIT_EXTERN(int) git_blame_init_options(
103+
GIT_EXTERN(int) git_blame_options_init(
104104
git_blame_options *opts,
105105
unsigned int version);
106106

include/git2/checkout.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ typedef void GIT_CALLBACK(git_checkout_perfdata_cb)(
256256
* Checkout options structure
257257
*
258258
* Initialize with `GIT_CHECKOUT_OPTIONS_INIT`. Alternatively, you can
259-
* use `git_checkout_init_options`.
259+
* use `git_checkout_options_init`.
260260
*
261261
*/
262262
typedef struct git_checkout_options {
@@ -318,7 +318,7 @@ typedef struct git_checkout_options {
318318
* @param version The struct version; pass `GIT_CHECKOUT_OPTIONS_VERSION`.
319319
* @return Zero on success; -1 on failure.
320320
*/
321-
GIT_EXTERN(int) git_checkout_init_options(
321+
GIT_EXTERN(int) git_checkout_options_init(
322322
git_checkout_options *opts,
323323
unsigned int version);
324324

include/git2/cherrypick.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ typedef struct {
4646
* @param version The struct version; pass `GIT_CHERRYPICK_OPTIONS_VERSION`.
4747
* @return Zero on success; -1 on failure.
4848
*/
49-
GIT_EXTERN(int) git_cherrypick_init_options(
49+
GIT_EXTERN(int) git_cherrypick_options_init(
5050
git_cherrypick_options *opts,
5151
unsigned int version);
5252

include/git2/clone.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ typedef int GIT_CALLBACK(git_repository_create_cb)(
9797
* Clone options structure
9898
*
9999
* Initialize with `GIT_CLONE_OPTIONS_INIT`. Alternatively, you can
100-
* use `git_clone_init_options`.
100+
* use `git_clone_options_init`.
101101
*
102102
*/
103103
typedef struct git_clone_options {
@@ -178,7 +178,7 @@ typedef struct git_clone_options {
178178
* @param version The struct version; pass `GIT_CLONE_OPTIONS_VERSION`.
179179
* @return Zero on success; -1 on failure.
180180
*/
181-
GIT_EXTERN(int) git_clone_init_options(
181+
GIT_EXTERN(int) git_clone_options_init(
182182
git_clone_options *opts,
183183
unsigned int version);
184184

include/git2/deprecated.h

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,29 @@
88
#define INCLUDE_git_deprecated_h__
99

1010
#include "common.h"
11+
#include "blame.h"
1112
#include "buffer.h"
13+
#include "checkout.h"
14+
#include "cherrypick.h"
15+
#include "clone.h"
16+
#include "describe.h"
17+
#include "diff.h"
1218
#include "errors.h"
1319
#include "index.h"
20+
#include "indexer.h"
21+
#include "merge.h"
1422
#include "object.h"
23+
#include "proxy.h"
1524
#include "refs.h"
25+
#include "rebase.h"
1626
#include "remote.h"
1727
#include "trace.h"
28+
#include "repository.h"
29+
#include "revert.h"
30+
#include "stash.h"
31+
#include "status.h"
32+
#include "submodule.h"
33+
#include "worktree.h"
1834

1935
/*
2036
* Users can avoid deprecated functions by defining `GIT_DEPRECATE_HARD`.
@@ -316,6 +332,45 @@ typedef git_push_transfer_progress_cb git_push_transfer_progress;
316332

317333
/**@}*/
318334

335+
/** @name Deprecated Options Initialization Functions
336+
*
337+
* These functions are retained for backward compatibility. The newer
338+
* versions of these functions should be preferred in all new code.
339+
*
340+
* There is no plan to remove these backward compatibility functions at
341+
* this time.
342+
*/
343+
/**@{*/
344+
345+
GIT_EXTERN(int) git_blame_init_options(git_blame_options *opts, unsigned int version);
346+
GIT_EXTERN(int) git_checkout_init_options(git_checkout_options *opts, unsigned int version);
347+
GIT_EXTERN(int) git_cherrypick_init_options(git_cherrypick_options *opts, unsigned int version);
348+
GIT_EXTERN(int) git_clone_init_options(git_clone_options *opts, unsigned int version);
349+
GIT_EXTERN(int) git_describe_init_options(git_describe_options *opts, unsigned int version);
350+
GIT_EXTERN(int) git_describe_init_format_options(git_describe_format_options *opts, unsigned int version);
351+
GIT_EXTERN(int) git_diff_init_options(git_diff_options *opts, unsigned int version);
352+
GIT_EXTERN(int) git_diff_find_init_options(git_diff_find_options *opts, unsigned int version);
353+
GIT_EXTERN(int) git_diff_format_email_init_options(git_diff_format_email_options *opts, unsigned int version);
354+
GIT_EXTERN(int) git_diff_patchid_init_options(git_diff_patchid_options *opts, unsigned int version);
355+
GIT_EXTERN(int) git_fetch_init_options(git_fetch_options *opts, unsigned int version);
356+
GIT_EXTERN(int) git_indexer_init_options(git_indexer_options *opts, unsigned int version);
357+
GIT_EXTERN(int) git_merge_init_options(git_merge_options *opts, unsigned int version);
358+
GIT_EXTERN(int) git_merge_file_init_input(git_merge_file_input *input, unsigned int version);
359+
GIT_EXTERN(int) git_merge_file_init_options(git_merge_file_options *opts, unsigned int version);
360+
GIT_EXTERN(int) git_proxy_init_options(git_proxy_options *opts, unsigned int version);
361+
GIT_EXTERN(int) git_push_init_options(git_push_options *opts, unsigned int version);
362+
GIT_EXTERN(int) git_rebase_init_options(git_rebase_options *opts, unsigned int version);
363+
GIT_EXTERN(int) git_remote_create_init_options(git_remote_create_options *opts, unsigned int version);
364+
GIT_EXTERN(int) git_repository_init_init_options(git_repository_init_options *opts, unsigned int version);
365+
GIT_EXTERN(int) git_revert_init_options(git_revert_options *opts, unsigned int version);
366+
GIT_EXTERN(int) git_stash_apply_init_options(git_stash_apply_options *opts, unsigned int version);
367+
GIT_EXTERN(int) git_status_init_options(git_status_options *opts, unsigned int version);
368+
GIT_EXTERN(int) git_submodule_update_init_options(git_submodule_update_options *opts, unsigned int version);
369+
GIT_EXTERN(int) git_worktree_add_init_options(git_worktree_add_options *opts, unsigned int version);
370+
GIT_EXTERN(int) git_worktree_prune_init_options(git_worktree_prune_options *opts, unsigned int version);
371+
372+
/**@}*/
373+
319374
/** @} */
320375
GIT_END_DECL
321376

include/git2/describe.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ typedef enum {
3737
* Describe options structure
3838
*
3939
* Initialize with `GIT_DESCRIBE_OPTIONS_INIT`. Alternatively, you can
40-
* use `git_describe_init_options`.
40+
* use `git_describe_options_init`.
4141
*
4242
*/
4343
typedef struct git_describe_options {
@@ -79,13 +79,13 @@ typedef struct git_describe_options {
7979
* @param version The struct version; pass `GIT_DESCRIBE_OPTIONS_VERSION`.
8080
* @return Zero on success; -1 on failure.
8181
*/
82-
GIT_EXTERN(int) git_describe_init_options(git_describe_options *opts, unsigned int version);
82+
GIT_EXTERN(int) git_describe_options_init(git_describe_options *opts, unsigned int version);
8383

8484
/**
8585
* Describe format options structure
8686
*
8787
* Initialize with `GIT_DESCRIBE_FORMAT_OPTIONS_INIT`. Alternatively, you can
88-
* use `git_describe_format_init_options`.
88+
* use `git_describe_format_options_init`.
8989
*
9090
*/
9191
typedef struct {
@@ -126,7 +126,7 @@ typedef struct {
126126
* @param version The struct version; pass `GIT_DESCRIBE_FORMAT_OPTIONS_VERSION`.
127127
* @return Zero on success; -1 on failure.
128128
*/
129-
GIT_EXTERN(int) git_describe_init_format_options(git_describe_format_options *opts, unsigned int version);
129+
GIT_EXTERN(int) git_describe_format_options_init(git_describe_format_options *opts, unsigned int version);
130130

131131
/**
132132
* A struct that stores the result of a describe operation.

include/git2/diff.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ typedef enum {
119119

120120
/** Include unreadable files in the diff */
121121
GIT_DIFF_INCLUDE_UNREADABLE = (1u << 16),
122-
122+
123123
/** Include unreadable files in the diff */
124124
GIT_DIFF_INCLUDE_UNREADABLE_AS_UNTRACKED = (1u << 17),
125125

@@ -451,7 +451,7 @@ typedef struct {
451451
* @param version The struct version; pass `GIT_DIFF_OPTIONS_VERSION`.
452452
* @return Zero on success; -1 on failure.
453453
*/
454-
GIT_EXTERN(int) git_diff_init_options(
454+
GIT_EXTERN(int) git_diff_options_init(
455455
git_diff_options *opts,
456456
unsigned int version);
457457

@@ -784,7 +784,7 @@ typedef struct {
784784
* @param version The struct version; pass `GIT_DIFF_FIND_OPTIONS_VERSION`.
785785
* @return Zero on success; -1 on failure.
786786
*/
787-
GIT_EXTERN(int) git_diff_find_init_options(
787+
GIT_EXTERN(int) git_diff_find_options_init(
788788
git_diff_find_options *opts,
789789
unsigned int version);
790790

@@ -1448,15 +1448,15 @@ GIT_EXTERN(int) git_diff_commit_as_email(
14481448
* @param version The struct version; pass `GIT_DIFF_FORMAT_EMAIL_OPTIONS_VERSION`.
14491449
* @return Zero on success; -1 on failure.
14501450
*/
1451-
GIT_EXTERN(int) git_diff_format_email_init_options(
1451+
GIT_EXTERN(int) git_diff_format_email_options_init(
14521452
git_diff_format_email_options *opts,
14531453
unsigned int version);
14541454

14551455
/**
14561456
* Patch ID options structure
14571457
*
14581458
* Initialize with `GIT_PATCHID_OPTIONS_INIT`. Alternatively, you can
1459-
* use `git_patchid_init_options`.
1459+
* use `git_diff_patchid_options_init`.
14601460
*
14611461
*/
14621462
typedef struct git_diff_patchid_options {
@@ -1476,7 +1476,7 @@ typedef struct git_diff_patchid_options {
14761476
* @param version The struct version; pass `GIT_DIFF_PATCHID_OPTIONS_VERSION`.
14771477
* @return Zero on success; -1 on failure.
14781478
*/
1479-
GIT_EXTERN(int) git_diff_patchid_init_options(
1479+
GIT_EXTERN(int) git_diff_patchid_options_init(
14801480
git_diff_patchid_options *opts,
14811481
unsigned int version);
14821482

include/git2/indexer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ typedef struct git_indexer_options {
7979
* @param version Version of struct; pass `GIT_INDEXER_OPTIONS_VERSION`
8080
* @return Zero on success; -1 on failure.
8181
*/
82-
GIT_EXTERN(int) git_indexer_init_options(
82+
GIT_EXTERN(int) git_indexer_options_init(
8383
git_indexer_options *opts,
8484
unsigned int version);
8585

0 commit comments

Comments
 (0)