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