mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-05 13:15:39 +00:00
git_revert_opts -> git_revert_options
This commit is contained in:
parent
6affd71f33
commit
aa17c3c63c
@ -28,22 +28,22 @@ typedef struct {
|
||||
|
||||
git_merge_tree_opts merge_tree_opts;
|
||||
git_checkout_options checkout_opts;
|
||||
} git_revert_opts;
|
||||
} git_revert_options;
|
||||
|
||||
#define GIT_REVERT_OPTS_VERSION 1
|
||||
#define GIT_REVERT_OPTS_INIT {GIT_REVERT_OPTS_VERSION, 0, GIT_MERGE_TREE_OPTS_INIT, GIT_CHECKOUT_OPTIONS_INIT}
|
||||
#define GIT_REVERT_OPTIONS_VERSION 1
|
||||
#define GIT_REVERT_OPTIONS_INIT {GIT_REVERT_OPTIONS_VERSION, 0, GIT_MERGE_TREE_OPTS_INIT, GIT_CHECKOUT_OPTIONS_INIT}
|
||||
|
||||
/**
|
||||
* Initializes a `git_revert_opts` with default values. Equivalent to
|
||||
* creating an instance with GIT_REVERT_OPTS_INIT.
|
||||
* Initializes a `git_revert_options` with default values. Equivalent to
|
||||
* creating an instance with GIT_REVERT_OPTIONS_INIT.
|
||||
*
|
||||
* @param opts the `git_revert_opts` instance to initialize.
|
||||
* @param opts the `git_revert_options` instance to initialize.
|
||||
* @param version the version of the struct; you should pass
|
||||
* `GIT_REVERT_OPTS_VERSION` here.
|
||||
* `GIT_REVERT_OPTIONS_VERSION` here.
|
||||
* @return Zero on success; -1 on failure.
|
||||
*/
|
||||
GIT_EXTERN(int) git_revert_init_opts(
|
||||
git_revert_opts* opts,
|
||||
git_revert_options* opts,
|
||||
int version);
|
||||
|
||||
/**
|
||||
@ -80,7 +80,7 @@ int git_revert_commit(
|
||||
GIT_EXTERN(int) git_revert(
|
||||
git_repository *repo,
|
||||
git_commit *commit,
|
||||
const git_revert_opts *given_opts);
|
||||
const git_revert_options *given_opts);
|
||||
|
||||
/** @} */
|
||||
GIT_END_DECL
|
||||
|
24
src/revert.c
24
src/revert.c
@ -67,8 +67,8 @@ cleanup:
|
||||
|
||||
static int revert_normalize_opts(
|
||||
git_repository *repo,
|
||||
git_revert_opts *opts,
|
||||
const git_revert_opts *given,
|
||||
git_revert_options *opts,
|
||||
const git_revert_options *given,
|
||||
const char *their_label)
|
||||
{
|
||||
int error = 0;
|
||||
@ -78,10 +78,10 @@ static int revert_normalize_opts(
|
||||
GIT_UNUSED(repo);
|
||||
|
||||
if (given != NULL)
|
||||
memcpy(opts, given, sizeof(git_revert_opts));
|
||||
memcpy(opts, given, sizeof(git_revert_options));
|
||||
else {
|
||||
git_revert_opts default_opts = GIT_REVERT_OPTS_INIT;
|
||||
memcpy(opts, &default_opts, sizeof(git_revert_opts));
|
||||
git_revert_options default_opts = GIT_REVERT_OPTIONS_INIT;
|
||||
memcpy(opts, &default_opts, sizeof(git_revert_options));
|
||||
}
|
||||
|
||||
if (!opts->checkout_opts.checkout_strategy)
|
||||
@ -166,9 +166,9 @@ done:
|
||||
int git_revert(
|
||||
git_repository *repo,
|
||||
git_commit *commit,
|
||||
const git_revert_opts *given_opts)
|
||||
const git_revert_options *given_opts)
|
||||
{
|
||||
git_revert_opts opts;
|
||||
git_revert_options opts;
|
||||
git_reference *our_ref = NULL;
|
||||
git_commit *our_commit = NULL;
|
||||
char commit_oidstr[GIT_OID_HEXSZ + 1];
|
||||
@ -179,7 +179,7 @@ int git_revert(
|
||||
|
||||
assert(repo && commit);
|
||||
|
||||
GITERR_CHECK_VERSION(given_opts, GIT_REVERT_OPTS_VERSION, "git_revert_opts");
|
||||
GITERR_CHECK_VERSION(given_opts, GIT_REVERT_OPTIONS_VERSION, "git_revert_options");
|
||||
|
||||
if ((error = git_repository__ensure_not_bare(repo, "revert")) < 0)
|
||||
return error;
|
||||
@ -219,13 +219,13 @@ done:
|
||||
return error;
|
||||
}
|
||||
|
||||
int git_revert_init_opts(git_revert_opts* opts, int version)
|
||||
int git_revert_init_opts(git_revert_options* opts, int version)
|
||||
{
|
||||
if (version != GIT_REVERT_OPTS_VERSION) {
|
||||
giterr_set(GITERR_INVALID, "Invalid version %d for git_revert_opts", version);
|
||||
if (version != GIT_REVERT_OPTIONS_VERSION) {
|
||||
giterr_set(GITERR_INVALID, "Invalid version %d for git_revert_options", version);
|
||||
return -1;
|
||||
} else {
|
||||
git_revert_opts o = GIT_REVERT_OPTS_INIT;
|
||||
git_revert_options o = GIT_REVERT_OPTIONS_INIT;
|
||||
memcpy(opts, &o, sizeof(o));
|
||||
return 0;
|
||||
}
|
||||
|
@ -347,7 +347,7 @@ void test_revert_workdir__conflict_use_ours(void)
|
||||
{
|
||||
git_commit *head, *commit;
|
||||
git_oid head_oid, revert_oid;
|
||||
git_revert_opts opts = GIT_REVERT_OPTS_INIT;
|
||||
git_revert_options opts = GIT_REVERT_OPTIONS_INIT;
|
||||
|
||||
struct merge_index_entry merge_index_entries[] = {
|
||||
{ 0100644, "caf99de3a49827117bb66721010eac461b06a80c", 0, "file1.txt" },
|
||||
@ -387,7 +387,7 @@ void test_revert_workdir__rename_1_of_2(void)
|
||||
{
|
||||
git_commit *head, *commit;
|
||||
git_oid head_oid, revert_oid;
|
||||
git_revert_opts opts = GIT_REVERT_OPTS_INIT;
|
||||
git_revert_options opts = GIT_REVERT_OPTIONS_INIT;
|
||||
|
||||
struct merge_index_entry merge_index_entries[] = {
|
||||
{ 0100644, "747726e021bc5f44b86de60e3032fd6f9f1b8383", 0, "file1.txt" },
|
||||
@ -421,7 +421,7 @@ void test_revert_workdir__rename(void)
|
||||
{
|
||||
git_commit *head, *commit;
|
||||
git_oid head_oid, revert_oid;
|
||||
git_revert_opts opts = GIT_REVERT_OPTS_INIT;
|
||||
git_revert_options opts = GIT_REVERT_OPTIONS_INIT;
|
||||
|
||||
struct merge_index_entry merge_index_entries[] = {
|
||||
{ 0100644, "55acf326a69f0aab7a974ec53ffa55a50bcac14e", 1, "file4.txt" },
|
||||
@ -480,7 +480,7 @@ void test_revert_workdir__nonmerge_fails_mainline_specified(void)
|
||||
{
|
||||
git_reference *head;
|
||||
git_commit *commit;
|
||||
git_revert_opts opts = GIT_REVERT_OPTS_INIT;
|
||||
git_revert_options opts = GIT_REVERT_OPTIONS_INIT;
|
||||
|
||||
cl_git_pass(git_repository_head(&head, repo));
|
||||
cl_git_pass(git_reference_peel((git_object **)&commit, head, GIT_OBJ_COMMIT));
|
||||
@ -518,7 +518,7 @@ void test_revert_workdir__merge_first_parent(void)
|
||||
{
|
||||
git_commit *head;
|
||||
git_oid head_oid;
|
||||
git_revert_opts opts = GIT_REVERT_OPTS_INIT;
|
||||
git_revert_options opts = GIT_REVERT_OPTIONS_INIT;
|
||||
|
||||
struct merge_index_entry merge_index_entries[] = {
|
||||
{ 0100644, "296a6d3be1dff05c5d1f631d2459389fa7b619eb", 0, "file-mainline.txt" },
|
||||
@ -543,7 +543,7 @@ void test_revert_workdir__merge_second_parent(void)
|
||||
{
|
||||
git_commit *head;
|
||||
git_oid head_oid;
|
||||
git_revert_opts opts = GIT_REVERT_OPTS_INIT;
|
||||
git_revert_options opts = GIT_REVERT_OPTIONS_INIT;
|
||||
|
||||
struct merge_index_entry merge_index_entries[] = {
|
||||
{ 0100644, "33c6fd981c49a2abf2971482089350bfc5cda8ea", 0, "file-branch.txt" },
|
||||
|
@ -92,8 +92,8 @@ void test_structinit_structinit__compare(void)
|
||||
|
||||
/* revert */
|
||||
CHECK_MACRO_FUNC_INIT_EQUAL( \
|
||||
git_revert_opts, GIT_REVERT_OPTS_VERSION, \
|
||||
GIT_REVERT_OPTS_INIT, git_revert_init_opts);
|
||||
git_revert_options, GIT_REVERT_OPTIONS_VERSION, \
|
||||
GIT_REVERT_OPTIONS_INIT, git_revert_init_opts);
|
||||
|
||||
/* status */
|
||||
CHECK_MACRO_FUNC_INIT_EQUAL( \
|
||||
|
Loading…
Reference in New Issue
Block a user