Unverified Commit 1ab0523d by Edward Thomson Committed by GitHub

Merge pull request #5101 from libgit2/ethomson/opts_init

Rename options initialization functions
parents bed33a6f c0dd7122
......@@ -148,8 +148,8 @@ static void describe_options_init(describe_options *opts)
opts->commits = NULL;
opts->commit_count = 0;
git_describe_init_options(&opts->describe_options, GIT_DESCRIBE_OPTIONS_VERSION);
git_describe_init_format_options(&opts->format_options, GIT_DESCRIBE_FORMAT_OPTIONS_VERSION);
git_describe_options_init(&opts->describe_options, GIT_DESCRIBE_OPTIONS_VERSION);
git_describe_format_options_init(&opts->format_options, GIT_DESCRIBE_FORMAT_OPTIONS_VERSION);
}
int lg2_describe(git_repository *repo, int argc, char **argv)
......
......@@ -57,7 +57,7 @@ typedef int GIT_CALLBACK(git_apply_hunk_cb)(
* Apply options structure
*
* Initialize with `GIT_APPLY_OPTIONS_INIT`. Alternatively, you can
* use `git_apply_init_options`.
* use `git_apply_options_init`.
*
* @see git_apply_to_tree, git_apply
*/
......@@ -72,6 +72,8 @@ typedef struct {
#define GIT_APPLY_OPTIONS_VERSION 1
#define GIT_APPLY_OPTIONS_INIT {GIT_APPLY_OPTIONS_VERSION}
GIT_EXTERN(int) git_apply_options_init(git_apply_options *opts, unsigned int version);
/**
* Apply a `git_diff` to a `git_tree`, and return the resulting image
* as an index.
......
......@@ -53,7 +53,7 @@ typedef enum {
* Blame options structure
*
* Initialize with `GIT_BLAME_OPTIONS_INIT`. Alternatively, you can
* use `git_blame_init_options`.
* use `git_blame_options_init`.
*
*/
typedef struct git_blame_options {
......@@ -100,7 +100,7 @@ typedef struct git_blame_options {
* @param version The struct version; pass `GIT_BLAME_OPTIONS_VERSION`.
* @return Zero on success; -1 on failure.
*/
GIT_EXTERN(int) git_blame_init_options(
GIT_EXTERN(int) git_blame_options_init(
git_blame_options *opts,
unsigned int version);
......
......@@ -256,7 +256,7 @@ typedef void GIT_CALLBACK(git_checkout_perfdata_cb)(
* Checkout options structure
*
* Initialize with `GIT_CHECKOUT_OPTIONS_INIT`. Alternatively, you can
* use `git_checkout_init_options`.
* use `git_checkout_options_init`.
*
*/
typedef struct git_checkout_options {
......@@ -318,7 +318,7 @@ typedef struct git_checkout_options {
* @param version The struct version; pass `GIT_CHECKOUT_OPTIONS_VERSION`.
* @return Zero on success; -1 on failure.
*/
GIT_EXTERN(int) git_checkout_init_options(
GIT_EXTERN(int) git_checkout_options_init(
git_checkout_options *opts,
unsigned int version);
......
......@@ -46,7 +46,7 @@ typedef struct {
* @param version The struct version; pass `GIT_CHERRYPICK_OPTIONS_VERSION`.
* @return Zero on success; -1 on failure.
*/
GIT_EXTERN(int) git_cherrypick_init_options(
GIT_EXTERN(int) git_cherrypick_options_init(
git_cherrypick_options *opts,
unsigned int version);
......
......@@ -97,7 +97,7 @@ typedef int GIT_CALLBACK(git_repository_create_cb)(
* Clone options structure
*
* Initialize with `GIT_CLONE_OPTIONS_INIT`. Alternatively, you can
* use `git_clone_init_options`.
* use `git_clone_options_init`.
*
*/
typedef struct git_clone_options {
......@@ -178,7 +178,7 @@ typedef struct git_clone_options {
* @param version The struct version; pass `GIT_CLONE_OPTIONS_VERSION`.
* @return Zero on success; -1 on failure.
*/
GIT_EXTERN(int) git_clone_init_options(
GIT_EXTERN(int) git_clone_options_init(
git_clone_options *opts,
unsigned int version);
......
......@@ -8,13 +8,29 @@
#define INCLUDE_git_deprecated_h__
#include "common.h"
#include "blame.h"
#include "buffer.h"
#include "checkout.h"
#include "cherrypick.h"
#include "clone.h"
#include "describe.h"
#include "diff.h"
#include "errors.h"
#include "index.h"
#include "indexer.h"
#include "merge.h"
#include "object.h"
#include "proxy.h"
#include "refs.h"
#include "rebase.h"
#include "remote.h"
#include "trace.h"
#include "repository.h"
#include "revert.h"
#include "stash.h"
#include "status.h"
#include "submodule.h"
#include "worktree.h"
/*
* Users can avoid deprecated functions by defining `GIT_DEPRECATE_HARD`.
......@@ -316,6 +332,45 @@ typedef git_push_transfer_progress_cb git_push_transfer_progress;
/**@}*/
/** @name Deprecated Options Initialization Functions
*
* These functions are retained for backward compatibility. The newer
* versions of these functions should be preferred in all new code.
*
* There is no plan to remove these backward compatibility functions at
* this time.
*/
/**@{*/
GIT_EXTERN(int) git_blame_init_options(git_blame_options *opts, unsigned int version);
GIT_EXTERN(int) git_checkout_init_options(git_checkout_options *opts, unsigned int version);
GIT_EXTERN(int) git_cherrypick_init_options(git_cherrypick_options *opts, unsigned int version);
GIT_EXTERN(int) git_clone_init_options(git_clone_options *opts, unsigned int version);
GIT_EXTERN(int) git_describe_init_options(git_describe_options *opts, unsigned int version);
GIT_EXTERN(int) git_describe_init_format_options(git_describe_format_options *opts, unsigned int version);
GIT_EXTERN(int) git_diff_init_options(git_diff_options *opts, unsigned int version);
GIT_EXTERN(int) git_diff_find_init_options(git_diff_find_options *opts, unsigned int version);
GIT_EXTERN(int) git_diff_format_email_init_options(git_diff_format_email_options *opts, unsigned int version);
GIT_EXTERN(int) git_diff_patchid_init_options(git_diff_patchid_options *opts, unsigned int version);
GIT_EXTERN(int) git_fetch_init_options(git_fetch_options *opts, unsigned int version);
GIT_EXTERN(int) git_indexer_init_options(git_indexer_options *opts, unsigned int version);
GIT_EXTERN(int) git_merge_init_options(git_merge_options *opts, unsigned int version);
GIT_EXTERN(int) git_merge_file_init_input(git_merge_file_input *input, unsigned int version);
GIT_EXTERN(int) git_merge_file_init_options(git_merge_file_options *opts, unsigned int version);
GIT_EXTERN(int) git_proxy_init_options(git_proxy_options *opts, unsigned int version);
GIT_EXTERN(int) git_push_init_options(git_push_options *opts, unsigned int version);
GIT_EXTERN(int) git_rebase_init_options(git_rebase_options *opts, unsigned int version);
GIT_EXTERN(int) git_remote_create_init_options(git_remote_create_options *opts, unsigned int version);
GIT_EXTERN(int) git_repository_init_init_options(git_repository_init_options *opts, unsigned int version);
GIT_EXTERN(int) git_revert_init_options(git_revert_options *opts, unsigned int version);
GIT_EXTERN(int) git_stash_apply_init_options(git_stash_apply_options *opts, unsigned int version);
GIT_EXTERN(int) git_status_init_options(git_status_options *opts, unsigned int version);
GIT_EXTERN(int) git_submodule_update_init_options(git_submodule_update_options *opts, unsigned int version);
GIT_EXTERN(int) git_worktree_add_init_options(git_worktree_add_options *opts, unsigned int version);
GIT_EXTERN(int) git_worktree_prune_init_options(git_worktree_prune_options *opts, unsigned int version);
/**@}*/
/** @} */
GIT_END_DECL
......
......@@ -37,7 +37,7 @@ typedef enum {
* Describe options structure
*
* Initialize with `GIT_DESCRIBE_OPTIONS_INIT`. Alternatively, you can
* use `git_describe_init_options`.
* use `git_describe_options_init`.
*
*/
typedef struct git_describe_options {
......@@ -79,13 +79,13 @@ typedef struct git_describe_options {
* @param version The struct version; pass `GIT_DESCRIBE_OPTIONS_VERSION`.
* @return Zero on success; -1 on failure.
*/
GIT_EXTERN(int) git_describe_init_options(git_describe_options *opts, unsigned int version);
GIT_EXTERN(int) git_describe_options_init(git_describe_options *opts, unsigned int version);
/**
* Describe format options structure
*
* Initialize with `GIT_DESCRIBE_FORMAT_OPTIONS_INIT`. Alternatively, you can
* use `git_describe_format_init_options`.
* use `git_describe_format_options_init`.
*
*/
typedef struct {
......@@ -126,7 +126,7 @@ typedef struct {
* @param version The struct version; pass `GIT_DESCRIBE_FORMAT_OPTIONS_VERSION`.
* @return Zero on success; -1 on failure.
*/
GIT_EXTERN(int) git_describe_init_format_options(git_describe_format_options *opts, unsigned int version);
GIT_EXTERN(int) git_describe_format_options_init(git_describe_format_options *opts, unsigned int version);
/**
* A struct that stores the result of a describe operation.
......
......@@ -451,7 +451,7 @@ typedef struct {
* @param version The struct version; pass `GIT_DIFF_OPTIONS_VERSION`.
* @return Zero on success; -1 on failure.
*/
GIT_EXTERN(int) git_diff_init_options(
GIT_EXTERN(int) git_diff_options_init(
git_diff_options *opts,
unsigned int version);
......@@ -784,7 +784,7 @@ typedef struct {
* @param version The struct version; pass `GIT_DIFF_FIND_OPTIONS_VERSION`.
* @return Zero on success; -1 on failure.
*/
GIT_EXTERN(int) git_diff_find_init_options(
GIT_EXTERN(int) git_diff_find_options_init(
git_diff_find_options *opts,
unsigned int version);
......@@ -1448,7 +1448,7 @@ GIT_EXTERN(int) git_diff_commit_as_email(
* @param version The struct version; pass `GIT_DIFF_FORMAT_EMAIL_OPTIONS_VERSION`.
* @return Zero on success; -1 on failure.
*/
GIT_EXTERN(int) git_diff_format_email_init_options(
GIT_EXTERN(int) git_diff_format_email_options_init(
git_diff_format_email_options *opts,
unsigned int version);
......@@ -1456,7 +1456,7 @@ GIT_EXTERN(int) git_diff_format_email_init_options(
* Patch ID options structure
*
* Initialize with `GIT_PATCHID_OPTIONS_INIT`. Alternatively, you can
* use `git_patchid_init_options`.
* use `git_diff_patchid_options_init`.
*
*/
typedef struct git_diff_patchid_options {
......@@ -1476,7 +1476,7 @@ typedef struct git_diff_patchid_options {
* @param version The struct version; pass `GIT_DIFF_PATCHID_OPTIONS_VERSION`.
* @return Zero on success; -1 on failure.
*/
GIT_EXTERN(int) git_diff_patchid_init_options(
GIT_EXTERN(int) git_diff_patchid_options_init(
git_diff_patchid_options *opts,
unsigned int version);
......
......@@ -79,7 +79,7 @@ typedef struct git_indexer_options {
* @param version Version of struct; pass `GIT_INDEXER_OPTIONS_VERSION`
* @return Zero on success; -1 on failure.
*/
GIT_EXTERN(int) git_indexer_init_options(
GIT_EXTERN(int) git_indexer_options_init(
git_indexer_options *opts,
unsigned int version);
......
......@@ -57,7 +57,7 @@ typedef struct {
* `GIT_MERGE_FILE_INPUT_VERSION` here.
* @return Zero on success; -1 on failure.
*/
GIT_EXTERN(int) git_merge_file_init_input(
GIT_EXTERN(int) git_merge_file_input_init(
git_merge_file_input *opts,
unsigned int version);
......@@ -212,9 +212,7 @@ typedef struct {
* @param version The struct version; pass `GIT_MERGE_FILE_OPTIONS_VERSION`.
* @return Zero on success; -1 on failure.
*/
GIT_EXTERN(int) git_merge_file_init_options(
git_merge_file_options *opts,
unsigned int version);
GIT_EXTERN(int) git_merge_file_options_init(git_merge_file_options *opts, unsigned int version);
/**
* Information about file-level merging
......@@ -310,9 +308,7 @@ typedef struct {
* @param version The struct version; pass `GIT_MERGE_OPTIONS_VERSION`.
* @return Zero on success; -1 on failure.
*/
GIT_EXTERN(int) git_merge_init_options(
git_merge_options *opts,
unsigned int version);
GIT_EXTERN(int) git_merge_options_init(git_merge_options *opts, unsigned int version);
/**
* The results of `git_merge_analysis` indicate the merge opportunities.
......
......@@ -89,7 +89,7 @@ typedef struct {
* @param version The struct version; pass `GIT_PROXY_OPTIONS_VERSION`.
* @return Zero on success; -1 on failure.
*/
GIT_EXTERN(int) git_proxy_init_options(git_proxy_options *opts, unsigned int version);
GIT_EXTERN(int) git_proxy_options_init(git_proxy_options *opts, unsigned int version);
GIT_END_DECL
......
......@@ -156,7 +156,7 @@ typedef struct {
* @param version The struct version; pass `GIT_REBASE_OPTIONS_VERSION`.
* @return Zero on success; -1 on failure.
*/
GIT_EXTERN(int) git_rebase_init_options(
GIT_EXTERN(int) git_rebase_options_init(
git_rebase_options *opts,
unsigned int version);
......
......@@ -56,7 +56,7 @@ typedef enum {
* Remote creation options structure
*
* Initialize with `GIT_REMOTE_CREATE_OPTIONS_INIT`. Alternatively, you can
* use `git_remote_create_init_options`.
* use `git_remote_create_options_init`.
*
*/
typedef struct git_remote_create_options {
......@@ -94,7 +94,7 @@ typedef struct git_remote_create_options {
* @param version The struct version; pass `GIT_REMOTE_CREATE_OPTIONS_VERSION`.
* @return Zero on success; -1 on failure.
*/
GIT_EXTERN(int) git_remote_create_init_options(
GIT_EXTERN(int) git_remote_create_options_init(
git_remote_create_options *opts,
unsigned int version);
......@@ -700,7 +700,7 @@ typedef struct {
* @param version The struct version; pass `GIT_FETCH_OPTIONS_VERSION`.
* @return Zero on success; -1 on failure.
*/
GIT_EXTERN(int) git_fetch_init_options(
GIT_EXTERN(int) git_fetch_options_init(
git_fetch_options *opts,
unsigned int version);
......@@ -750,7 +750,7 @@ typedef struct {
* @param version The struct version; pass `GIT_PUSH_OPTIONS_VERSION`.
* @return Zero on success; -1 on failure.
*/
GIT_EXTERN(int) git_push_init_options(
GIT_EXTERN(int) git_push_options_init(
git_push_options *opts,
unsigned int version);
......
......@@ -323,7 +323,7 @@ typedef struct {
* @param version The struct version; pass `GIT_REPOSITORY_INIT_OPTIONS_VERSION`.
* @return Zero on success; -1 on failure.
*/
GIT_EXTERN(int) git_repository_init_init_options(
GIT_EXTERN(int) git_repository_init_options_init(
git_repository_init_options *opts,
unsigned int version);
......
......@@ -46,7 +46,7 @@ typedef struct {
* @param version The struct version; pass `GIT_REVERT_OPTIONS_VERSION`.
* @return Zero on success; -1 on failure.
*/
GIT_EXTERN(int) git_revert_init_options(
GIT_EXTERN(int) git_revert_options_init(
git_revert_options *opts,
unsigned int version);
......
......@@ -120,7 +120,7 @@ typedef int GIT_CALLBACK(git_stash_apply_progress_cb)(
* Stash application options structure
*
* Initialize with `GIT_STASH_APPLY_OPTIONS_INIT`. Alternatively, you can
* use `git_stash_apply_init_options`.
* use `git_stash_apply_options_init`.
*
*/
typedef struct git_stash_apply_options {
......@@ -153,7 +153,7 @@ typedef struct git_stash_apply_options {
* @param version The struct version; pass `GIT_STASH_APPLY_OPTIONS_VERSION`.
* @return Zero on success; -1 on failure.
*/
GIT_EXTERN(int) git_stash_apply_init_options(
GIT_EXTERN(int) git_stash_apply_options_init(
git_stash_apply_options *opts, unsigned int version);
/**
......
......@@ -200,7 +200,7 @@ typedef struct {
* @param version The struct version; pass `GIT_STATUS_OPTIONS_VERSION`.
* @return Zero on success; -1 on failure.
*/
GIT_EXTERN(int) git_status_init_options(
GIT_EXTERN(int) git_status_options_init(
git_status_options *opts,
unsigned int version);
......
......@@ -122,7 +122,7 @@ typedef int GIT_CALLBACK(git_submodule_cb)(
* Submodule update options structure
*
* Initialize with `GIT_SUBMODULE_UPDATE_OPTIONS_INIT`. Alternatively, you can
* use `git_submodule_update_init_options`.
* use `git_submodule_update_options_init`.
*
*/
typedef struct git_submodule_update_options {
......@@ -168,7 +168,7 @@ typedef struct git_submodule_update_options {
* @param version The struct version; pass `GIT_SUBMODULE_UPDATE_OPTIONS_VERSION`.
* @return Zero on success; -1 on failure.
*/
GIT_EXTERN(int) git_submodule_update_init_options(
GIT_EXTERN(int) git_submodule_update_options_init(
git_submodule_update_options *opts, unsigned int version);
/**
......
......@@ -78,7 +78,7 @@ GIT_EXTERN(int) git_worktree_validate(const git_worktree *wt);
* Worktree add options structure
*
* Initialize with `GIT_WORKTREE_ADD_OPTIONS_INIT`. Alternatively, you can
* use `git_worktree_add_init_options`.
* use `git_worktree_add_options_init`.
*
*/
typedef struct git_worktree_add_options {
......@@ -101,7 +101,7 @@ typedef struct git_worktree_add_options {
* @param version The struct version; pass `GIT_WORKTREE_ADD_OPTIONS_VERSION`.
* @return Zero on success; -1 on failure.
*/
GIT_EXTERN(int) git_worktree_add_init_options(git_worktree_add_options *opts,
GIT_EXTERN(int) git_worktree_add_options_init(git_worktree_add_options *opts,
unsigned int version);
/**
......@@ -192,7 +192,7 @@ typedef enum {
* Worktree prune options structure
*
* Initialize with `GIT_WORKTREE_PRUNE_OPTIONS_INIT`. Alternatively, you can
* use `git_worktree_prune_init_options`.
* use `git_worktree_prune_options_init`.
*
*/
typedef struct git_worktree_prune_options {
......@@ -214,7 +214,7 @@ typedef struct git_worktree_prune_options {
* @param version The struct version; pass `GIT_WORKTREE_PRUNE_OPTIONS_VERSION`.
* @return Zero on success; -1 on failure.
*/
GIT_EXTERN(int) git_worktree_prune_init_options(
GIT_EXTERN(int) git_worktree_prune_options_init(
git_worktree_prune_options *opts,
unsigned int version);
......
......@@ -745,6 +745,13 @@ done:
return error;
}
int git_apply_options_init(git_apply_options *opts, unsigned int version)
{
GIT_INIT_STRUCTURE_FROM_TEMPLATE(
opts, version, git_apply_options, GIT_APPLY_OPTIONS_INIT);
return 0;
}
/*
* Handle the three application options ("locations"):
*
......
......@@ -524,9 +524,14 @@ int git_blame_buffer(
return 0;
}
int git_blame_init_options(git_blame_options *opts, unsigned int version)
int git_blame_options_init(git_blame_options *opts, unsigned int version)
{
GIT_INIT_STRUCTURE_FROM_TEMPLATE(
opts, version, git_blame_options, GIT_BLAME_OPTIONS_INIT);
return 0;
}
int git_blame_init_options(git_blame_options *opts, unsigned int version)
{
return git_blame_options_init(opts, version);
}
......@@ -2791,9 +2791,14 @@ int git_checkout_head(
return git_checkout_tree(repo, NULL, opts);
}
int git_checkout_init_options(git_checkout_options *opts, unsigned int version)
int git_checkout_options_init(git_checkout_options *opts, unsigned int version)
{
GIT_INIT_STRUCTURE_FROM_TEMPLATE(
opts, version, git_checkout_options, GIT_CHECKOUT_OPTIONS_INIT);
return 0;
}
int git_checkout_init_options(git_checkout_options *opts, unsigned int version)
{
return git_checkout_options_init(opts, version);
}
......@@ -221,10 +221,16 @@ done:
return error;
}
int git_cherrypick_init_options(
int git_cherrypick_options_init(
git_cherrypick_options *opts, unsigned int version)
{
GIT_INIT_STRUCTURE_FROM_TEMPLATE(
opts, version, git_cherrypick_options, GIT_CHERRYPICK_OPTIONS_INIT);
return 0;
}
int git_cherrypick_init_options(
git_cherrypick_options *opts, unsigned int version)
{
return git_cherrypick_options_init(opts, version);
}
......@@ -455,13 +455,18 @@ int git_clone(
return error;
}
int git_clone_init_options(git_clone_options *opts, unsigned int version)
int git_clone_options_init(git_clone_options *opts, unsigned int version)
{
GIT_INIT_STRUCTURE_FROM_TEMPLATE(
opts, version, git_clone_options, GIT_CLONE_OPTIONS_INIT);
return 0;
}
int git_clone_init_options(git_clone_options *opts, unsigned int version)
{
return git_clone_options_init(opts, version);
}
static bool can_link(const char *src, const char *dst, int link)
{
#ifdef GIT_WIN32
......
......@@ -759,7 +759,7 @@ static int normalize_format_options(
const git_describe_format_options *src)
{
if (!src) {
git_describe_init_format_options(dst, GIT_DESCRIBE_FORMAT_OPTIONS_VERSION);
git_describe_format_options_init(dst, GIT_DESCRIBE_FORMAT_OPTIONS_VERSION);
return 0;
}
......@@ -868,16 +868,26 @@ void git_describe_result_free(git_describe_result *result)
git__free(result);
}
int git_describe_init_options(git_describe_options *opts, unsigned int version)
int git_describe_options_init(git_describe_options *opts, unsigned int version)
{
GIT_INIT_STRUCTURE_FROM_TEMPLATE(
opts, version, git_describe_options, GIT_DESCRIBE_OPTIONS_INIT);
return 0;
}
int git_describe_init_format_options(git_describe_format_options *opts, unsigned int version)
int git_describe_init_options(git_describe_options *opts, unsigned int version)
{
return git_describe_options_init(opts, version);
}
int git_describe_format_options_init(git_describe_format_options *opts, unsigned int version)
{
GIT_INIT_STRUCTURE_FROM_TEMPLATE(
opts, version, git_describe_format_options, GIT_DESCRIBE_FORMAT_OPTIONS_INIT);
return 0;
}
int git_describe_init_format_options(git_describe_format_options *opts, unsigned int version)
{
return git_describe_format_options_init(opts, version);
}
......@@ -350,14 +350,19 @@ int git_diff_commit_as_email(
return error;
}
int git_diff_init_options(git_diff_options *opts, unsigned int version)
int git_diff_options_init(git_diff_options *opts, unsigned int version)
{
GIT_INIT_STRUCTURE_FROM_TEMPLATE(
opts, version, git_diff_options, GIT_DIFF_OPTIONS_INIT);
return 0;
}
int git_diff_find_init_options(
int git_diff_init_options(git_diff_options *opts, unsigned int version)
{
return git_diff_options_init(opts, version);
}
int git_diff_find_options_init(
git_diff_find_options *opts, unsigned int version)
{
GIT_INIT_STRUCTURE_FROM_TEMPLATE(
......@@ -365,7 +370,13 @@ int git_diff_find_init_options(
return 0;
}
int git_diff_format_email_init_options(
int git_diff_find_init_options(
git_diff_find_options *opts, unsigned int version)
{
return git_diff_find_options_init(opts, version);
}
int git_diff_format_email_options_init(
git_diff_format_email_options *opts, unsigned int version)
{
GIT_INIT_STRUCTURE_FROM_TEMPLATE(
......@@ -374,6 +385,12 @@ int git_diff_format_email_init_options(
return 0;
}
int git_diff_format_email_init_options(
git_diff_format_email_options *opts, unsigned int version)
{
return git_diff_format_email_options_init(opts, version);
}
static int flush_hunk(git_oid *result, git_hash_ctx *ctx)
{
git_oid hash;
......@@ -481,7 +498,7 @@ out:
return error;
}
int git_diff_patchid_init_options(git_diff_patchid_options *opts, unsigned int version)
int git_diff_patchid_options_init(git_diff_patchid_options *opts, unsigned int version)
{
GIT_INIT_STRUCTURE_FROM_TEMPLATE(
opts, version, git_diff_patchid_options, GIT_DIFF_PATCHID_OPTIONS_INIT);
......
......@@ -45,7 +45,7 @@ static git_diff_parsed *diff_parsed_alloc(void)
diff->base.patch_fn = git_patch_parsed_from_diff;
diff->base.free_fn = diff_parsed_free;
if (git_diff_init_options(&diff->base.opts, GIT_DIFF_OPTIONS_VERSION) < 0) {
if (git_diff_options_init(&diff->base.opts, GIT_DIFF_OPTIONS_VERSION) < 0) {
git__free(diff);
return NULL;
}
......
......@@ -148,9 +148,14 @@ int git_fetch_download_pack(git_remote *remote, const git_remote_callbacks *call
return t->download_pack(t, remote->repo, &remote->stats, progress, payload);
}
int git_fetch_init_options(git_fetch_options *opts, unsigned int version)
int git_fetch_options_init(git_fetch_options *opts, unsigned int version)
{
GIT_INIT_STRUCTURE_FROM_TEMPLATE(
opts, version, git_fetch_options, GIT_FETCH_OPTIONS_INIT);
return 0;
}
int git_fetch_init_options(git_fetch_options *opts, unsigned int version)
{
return git_fetch_options_init(opts, version);
}
......@@ -116,13 +116,18 @@ static int objects_cmp(const void *a, const void *b)
return git_oid__cmp(&entrya->oid, &entryb->oid);
}
int git_indexer_init_options(git_indexer_options *opts, unsigned int version)
int git_indexer_options_init(git_indexer_options *opts, unsigned int version)
{
GIT_INIT_STRUCTURE_FROM_TEMPLATE(
opts, version, git_indexer_options, GIT_INDEXER_OPTIONS_INIT);
return 0;
}
int git_indexer_init_options(git_indexer_options *opts, unsigned int version)
{
return git_indexer_options_init(opts, version);
}
int git_indexer_new(
git_indexer **out,
const char *prefix,
......
......@@ -3322,24 +3322,40 @@ done:
return error;
}
int git_merge_init_options(git_merge_options *opts, unsigned int version)
int git_merge_options_init(git_merge_options *opts, unsigned int version)
{
GIT_INIT_STRUCTURE_FROM_TEMPLATE(
opts, version, git_merge_options, GIT_MERGE_OPTIONS_INIT);
return 0;
}
int git_merge_file_init_input(git_merge_file_input *input, unsigned int version)
int git_merge_init_options(git_merge_options *opts, unsigned int version)
{
return git_merge_options_init(opts, version);
}
int git_merge_file_input_init(git_merge_file_input *input, unsigned int version)
{
GIT_INIT_STRUCTURE_FROM_TEMPLATE(
input, version, git_merge_file_input, GIT_MERGE_FILE_INPUT_INIT);
return 0;
}
int git_merge_file_init_options(
int git_merge_file_init_input(git_merge_file_input *input, unsigned int version)
{
return git_merge_file_input_init(input, version);
}
int git_merge_file_options_init(
git_merge_file_options *opts, unsigned int version)
{
GIT_INIT_STRUCTURE_FROM_TEMPLATE(
opts, version, git_merge_file_options, GIT_MERGE_FILE_OPTIONS_INIT);
return 0;
}
int git_merge_file_init_options(
git_merge_file_options *opts, unsigned int version)
{
return git_merge_file_options_init(opts, version);
}
......@@ -9,17 +9,22 @@
#include "git2/proxy.h"
int git_proxy_init_options(git_proxy_options *opts, unsigned int version)
int git_proxy_options_init(git_proxy_options *opts, unsigned int version)
{
GIT_INIT_STRUCTURE_FROM_TEMPLATE(
opts, version, git_proxy_options, GIT_PROXY_OPTIONS_INIT);
return 0;
}
int git_proxy_init_options(git_proxy_options *opts, unsigned int version)
{
return git_proxy_options_init(opts, version);
}
int git_proxy_options_dup(git_proxy_options *tgt, const git_proxy_options *src)
{
if (!src) {
git_proxy_init_options(tgt, GIT_PROXY_OPTIONS_VERSION);
git_proxy_options_init(tgt, GIT_PROXY_OPTIONS_VERSION);
return 0;
}
......
......@@ -547,9 +547,14 @@ void git_push_free(git_push *push)
git__free(push);
}
int git_push_init_options(git_push_options *opts, unsigned int version)
int git_push_options_init(git_push_options *opts, unsigned int version)
{
GIT_INIT_STRUCTURE_FROM_TEMPLATE(
opts, version, git_push_options, GIT_PUSH_OPTIONS_INIT);
return 0;
}
int git_push_init_options(git_push_options *opts, unsigned int version)
{
return git_push_options_init(opts, version);
}
......@@ -268,7 +268,7 @@ static int rebase_alloc(git_rebase **out, const git_rebase_options *rebase_opts)
if (rebase_opts)
memcpy(&rebase->options, rebase_opts, sizeof(git_rebase_options));
else
git_rebase_init_options(&rebase->options, GIT_REBASE_OPTIONS_VERSION);
git_rebase_options_init(&rebase->options, GIT_REBASE_OPTIONS_VERSION);
if (rebase_opts && rebase_opts->rewrite_notes_ref) {
rebase->options.rewrite_notes_ref = git__strdup(rebase_opts->rewrite_notes_ref);
......@@ -493,13 +493,18 @@ static int rebase_setupfiles(git_rebase *rebase)
return rebase_setupfiles_merge(rebase);
}
int git_rebase_init_options(git_rebase_options *opts, unsigned int version)
int git_rebase_options_init(git_rebase_options *opts, unsigned int version)
{
GIT_INIT_STRUCTURE_FROM_TEMPLATE(
opts, version, git_rebase_options, GIT_REBASE_OPTIONS_INIT);
return 0;
}
int git_rebase_init_options(git_rebase_options *opts, unsigned int version)
{
return git_rebase_options_init(opts, version);
}
static int rebase_ensure_not_in_progress(git_repository *repo)
{
int error;
......
......@@ -217,13 +217,18 @@ static int ensure_remote_doesnot_exist(git_repository *repo, const char *name)
return GIT_EEXISTS;
}
int git_remote_create_init_options(git_remote_create_options *opts, unsigned int version)
int git_remote_create_options_init(git_remote_create_options *opts, unsigned int version)
{
GIT_INIT_STRUCTURE_FROM_TEMPLATE(
opts, version, git_remote_create_options, GIT_REMOTE_CREATE_OPTIONS_INIT);
return 0;
}
int git_remote_create_init_options(git_remote_create_options *opts, unsigned int version)
{
return git_remote_create_options_init(opts, version);
}
int git_remote_create_with_opts(git_remote **out, const char *url, const git_remote_create_options *opts)
{
git_remote *remote = NULL;
......
......@@ -2870,7 +2870,7 @@ int git_repository_is_shallow(git_repository *repo)
return st.st_size == 0 ? 0 : 1;
}
int git_repository_init_init_options(
int git_repository_init_options_init(
git_repository_init_options *opts, unsigned int version)
{
GIT_INIT_STRUCTURE_FROM_TEMPLATE(
......@@ -2879,6 +2879,12 @@ int git_repository_init_init_options(
return 0;
}
int git_repository_init_init_options(
git_repository_init_options *opts, unsigned int version)
{
return git_repository_init_options_init(opts, version);
}
int git_repository_ident(const char **name, const char **email, const git_repository *repo)
{
*name = repo->ident_name;
......
......@@ -224,9 +224,14 @@ done:
return error;
}
int git_revert_init_options(git_revert_options *opts, unsigned int version)
int git_revert_options_init(git_revert_options *opts, unsigned int version)
{
GIT_INIT_STRUCTURE_FROM_TEMPLATE(
opts, version, git_revert_options, GIT_REVERT_OPTIONS_INIT);
return 0;
}
int git_revert_init_options(git_revert_options *opts, unsigned int version)
{
return git_revert_options_init(opts, version);
}
......@@ -794,13 +794,18 @@ static void normalize_apply_options(
opts->checkout_options.their_label = "Stashed changes";
}
int git_stash_apply_init_options(git_stash_apply_options *opts, unsigned int version)
int git_stash_apply_options_init(git_stash_apply_options *opts, unsigned int version)
{
GIT_INIT_STRUCTURE_FROM_TEMPLATE(
opts, version, git_stash_apply_options, GIT_STASH_APPLY_OPTIONS_INIT);
return 0;
}
int git_stash_apply_init_options(git_stash_apply_options *opts, unsigned int version)
{
return git_stash_apply_options_init(opts, version);
}
#define NOTIFY_PROGRESS(opts, progress_type) \
do { \
if ((opts).progress_cb && \
......
......@@ -540,13 +540,18 @@ int git_status_should_ignore(
return git_ignore_path_is_ignored(ignored, repo, path);
}
int git_status_init_options(git_status_options *opts, unsigned int version)
int git_status_options_init(git_status_options *opts, unsigned int version)
{
GIT_INIT_STRUCTURE_FROM_TEMPLATE(
opts, version, git_status_options, GIT_STATUS_OPTIONS_INIT);
return 0;
}
int git_status_init_options(git_status_options *opts, unsigned int version)
{
return git_status_options_init(opts, version);
}
int git_status_list_get_perfdata(
git_diff_perfdata *out, const git_status_list *status)
{
......
......@@ -1174,13 +1174,18 @@ static int git_submodule_update_repo_init_cb(
return submodule_repo_create(out, sm->repo, path);
}
int git_submodule_update_init_options(git_submodule_update_options *opts, unsigned int version)
int git_submodule_update_options_init(git_submodule_update_options *opts, unsigned int version)
{
GIT_INIT_STRUCTURE_FROM_TEMPLATE(
opts, version, git_submodule_update_options, GIT_SUBMODULE_UPDATE_OPTIONS_INIT);
return 0;
}
int git_submodule_update_init_options(git_submodule_update_options *opts, unsigned int version)
{
return git_submodule_update_options_init(opts, version);
}
int git_submodule_update(git_submodule *sm, int init, git_submodule_update_options *_update_options)
{
int error;
......
......@@ -757,7 +757,7 @@ static int load_proxy_config(http_subtransport *t)
git__free(t->proxy_url);
t->proxy_url = NULL;
git_proxy_init_options(&t->proxy_opts, GIT_PROXY_OPTIONS_VERSION);
git_proxy_options_init(&t->proxy_opts, GIT_PROXY_OPTIONS_VERSION);
if ((error = git_remote__get_http_proxy(t->owner->owner,
!strcmp(t->server.url.scheme, "https"), &t->proxy_url)) < 0)
......
......@@ -260,7 +260,7 @@ int git_worktree_validate(const git_worktree *wt)
return 0;
}
int git_worktree_add_init_options(git_worktree_add_options *opts,
int git_worktree_add_options_init(git_worktree_add_options *opts,
unsigned int version)
{
GIT_INIT_STRUCTURE_FROM_TEMPLATE(opts, version,
......@@ -268,6 +268,12 @@ int git_worktree_add_init_options(git_worktree_add_options *opts,
return 0;
}
int git_worktree_add_init_options(git_worktree_add_options *opts,
unsigned int version)
{
return git_worktree_add_options_init(opts, version);
}
int git_worktree_add(git_worktree **out, git_repository *repo,
const char *name, const char *worktree,
const git_worktree_add_options *opts)
......@@ -478,7 +484,7 @@ const char *git_worktree_path(const git_worktree *wt)
return wt->worktree_path;
}
int git_worktree_prune_init_options(
int git_worktree_prune_options_init(
git_worktree_prune_options *opts,
unsigned int version)
{
......@@ -487,6 +493,12 @@ int git_worktree_prune_init_options(
return 0;
}
int git_worktree_pruneinit_options(git_worktree_prune_options *opts,
unsigned int version)
{
return git_worktree_prune_options_init(opts, version);
}
int git_worktree_is_prunable(git_worktree *wt,
git_worktree_prune_options *opts)
{
......
......@@ -33,7 +33,7 @@ void test_checkout_icase__initialize(void)
cl_git_pass(git_reference_name_to_id(&id, repo, "refs/heads/dir"));
cl_git_pass(git_object_lookup(&obj, repo, &id, GIT_OBJECT_ANY));
git_checkout_init_options(&checkout_opts, GIT_CHECKOUT_OPTIONS_VERSION);
git_checkout_options_init(&checkout_opts, GIT_CHECKOUT_OPTIONS_VERSION);
checkout_opts.checkout_strategy = GIT_CHECKOUT_NONE;
}
......
......@@ -72,30 +72,35 @@ void test_core_structinit__compare(void)
clar__skip();
#endif
/* apply */
CHECK_MACRO_FUNC_INIT_EQUAL( \
git_apply_options, GIT_APPLY_OPTIONS_VERSION, \
GIT_APPLY_OPTIONS_INIT, git_apply_options_init);
/* blame */
CHECK_MACRO_FUNC_INIT_EQUAL( \
git_blame_options, GIT_BLAME_OPTIONS_VERSION, \
GIT_BLAME_OPTIONS_INIT, git_blame_init_options);
GIT_BLAME_OPTIONS_INIT, git_blame_options_init);
/* checkout */
CHECK_MACRO_FUNC_INIT_EQUAL( \
git_checkout_options, GIT_CHECKOUT_OPTIONS_VERSION, \
GIT_CHECKOUT_OPTIONS_INIT, git_checkout_init_options);
GIT_CHECKOUT_OPTIONS_INIT, git_checkout_options_init);
/* clone */
CHECK_MACRO_FUNC_INIT_EQUAL( \
git_clone_options, GIT_CLONE_OPTIONS_VERSION, \
GIT_CLONE_OPTIONS_INIT, git_clone_init_options);
GIT_CLONE_OPTIONS_INIT, git_clone_options_init);
/* diff */
CHECK_MACRO_FUNC_INIT_EQUAL( \
git_diff_options, GIT_DIFF_OPTIONS_VERSION, \
GIT_DIFF_OPTIONS_INIT, git_diff_init_options);
GIT_DIFF_OPTIONS_INIT, git_diff_options_init);
/* diff_find */
CHECK_MACRO_FUNC_INIT_EQUAL( \
git_diff_find_options, GIT_DIFF_FIND_OPTIONS_VERSION, \
GIT_DIFF_FIND_OPTIONS_INIT, git_diff_find_init_options);
GIT_DIFF_FIND_OPTIONS_INIT, git_diff_find_options_init);
/* filter */
CHECK_MACRO_FUNC_INIT_EQUAL( \
......@@ -105,22 +110,22 @@ void test_core_structinit__compare(void)
/* merge_file_input */
CHECK_MACRO_FUNC_INIT_EQUAL( \
git_merge_file_input, GIT_MERGE_FILE_INPUT_VERSION, \
GIT_MERGE_FILE_INPUT_INIT, git_merge_file_init_input);
GIT_MERGE_FILE_INPUT_INIT, git_merge_file_input_init);
/* merge_file */
CHECK_MACRO_FUNC_INIT_EQUAL( \
git_merge_file_options, GIT_MERGE_FILE_OPTIONS_VERSION, \
GIT_MERGE_FILE_OPTIONS_INIT, git_merge_file_init_options);
GIT_MERGE_FILE_OPTIONS_INIT, git_merge_file_options_init);
/* merge_tree */
CHECK_MACRO_FUNC_INIT_EQUAL( \
git_merge_options, GIT_MERGE_OPTIONS_VERSION, \
GIT_MERGE_OPTIONS_INIT, git_merge_init_options);
GIT_MERGE_OPTIONS_INIT, git_merge_options_init);
/* push */
CHECK_MACRO_FUNC_INIT_EQUAL( \
git_push_options, GIT_PUSH_OPTIONS_VERSION, \
GIT_PUSH_OPTIONS_INIT, git_push_init_options);
GIT_PUSH_OPTIONS_INIT, git_push_options_init);
/* remote */
CHECK_MACRO_FUNC_INIT_EQUAL( \
......@@ -130,22 +135,22 @@ void test_core_structinit__compare(void)
/* repository_init */
CHECK_MACRO_FUNC_INIT_EQUAL( \
git_repository_init_options, GIT_REPOSITORY_INIT_OPTIONS_VERSION, \
GIT_REPOSITORY_INIT_OPTIONS_INIT, git_repository_init_init_options);
GIT_REPOSITORY_INIT_OPTIONS_INIT, git_repository_init_options_init);
/* revert */
CHECK_MACRO_FUNC_INIT_EQUAL( \
git_revert_options, GIT_REVERT_OPTIONS_VERSION, \
GIT_REVERT_OPTIONS_INIT, git_revert_init_options);
GIT_REVERT_OPTIONS_INIT, git_revert_options_init);
/* stash apply */
CHECK_MACRO_FUNC_INIT_EQUAL( \
git_stash_apply_options, GIT_STASH_APPLY_OPTIONS_VERSION, \
GIT_STASH_APPLY_OPTIONS_INIT, git_stash_apply_init_options);
GIT_STASH_APPLY_OPTIONS_INIT, git_stash_apply_options_init);
/* status */
CHECK_MACRO_FUNC_INIT_EQUAL( \
git_status_options, GIT_STATUS_OPTIONS_VERSION, \
GIT_STATUS_OPTIONS_INIT, git_status_init_options);
GIT_STATUS_OPTIONS_INIT, git_status_options_init);
/* transport */
CHECK_MACRO_FUNC_INIT_EQUAL( \
......@@ -170,14 +175,14 @@ void test_core_structinit__compare(void)
/* submodule update */
CHECK_MACRO_FUNC_INIT_EQUAL( \
git_submodule_update_options, GIT_SUBMODULE_UPDATE_OPTIONS_VERSION, \
GIT_SUBMODULE_UPDATE_OPTIONS_INIT, git_submodule_update_init_options);
GIT_SUBMODULE_UPDATE_OPTIONS_INIT, git_submodule_update_options_init);
/* submodule update */
CHECK_MACRO_FUNC_INIT_EQUAL( \
git_proxy_options, GIT_PROXY_OPTIONS_VERSION, \
GIT_PROXY_OPTIONS_INIT, git_proxy_init_options);
GIT_PROXY_OPTIONS_INIT, git_proxy_options_init);
CHECK_MACRO_FUNC_INIT_EQUAL( \
git_diff_patchid_options, GIT_DIFF_PATCHID_OPTIONS_VERSION, \
GIT_DIFF_PATCHID_OPTIONS_INIT, git_diff_patchid_init_options);
GIT_DIFF_PATCHID_OPTIONS_INIT, git_diff_patchid_options_init);
}
......@@ -39,7 +39,7 @@ void test_diff_blob__initialize(void)
g_repo = cl_git_sandbox_init("attr");
cl_git_pass(git_diff_init_options(&opts, GIT_DIFF_OPTIONS_VERSION));
cl_git_pass(git_diff_options_init(&opts, GIT_DIFF_OPTIONS_VERSION));
opts.context_lines = 1;
memset(&expected, 0, sizeof(expected));
......
......@@ -692,7 +692,7 @@ void test_diff_patch__can_strip_bad_utf8(void)
git_patch *patch;
git_buf buf = GIT_BUF_INIT;
cl_git_pass(git_diff_init_options(&opts, GIT_DIFF_OPTIONS_VERSION));
cl_git_pass(git_diff_options_init(&opts, GIT_DIFF_OPTIONS_VERSION));
cl_git_pass(git_patch_from_buffers(&patch, a, strlen(a), NULL, b, strlen(b), NULL, &opts));
cl_git_pass(git_patch_to_buf(&buf, patch));
......
......@@ -9,7 +9,7 @@ static diff_expects expect;
void test_diff_tree__initialize(void)
{
cl_git_pass(git_diff_init_options(&opts, GIT_DIFF_OPTIONS_VERSION));
cl_git_pass(git_diff_options_init(&opts, GIT_DIFF_OPTIONS_VERSION));
memset(&expect, 0, sizeof(expect));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment