Commit bf9a7e06 by Vicent Marti

Merge pull request #2485 from ethomson/cherrypick

Rename git_cherry_pick to git_cherrypick
parents 091165c5 0ba4dca5
......@@ -28,21 +28,21 @@ typedef struct {
git_merge_options merge_opts;
git_checkout_options checkout_opts;
} git_cherry_pick_options;
} git_cherrypick_options;
#define GIT_CHERRY_PICK_OPTIONS_VERSION 1
#define GIT_CHERRY_PICK_OPTIONS_INIT {GIT_CHERRY_PICK_OPTIONS_VERSION, 0, GIT_MERGE_OPTIONS_INIT, GIT_CHECKOUT_OPTIONS_INIT}
#define GIT_CHERRYPICK_OPTIONS_VERSION 1
#define GIT_CHERRYPICK_OPTIONS_INIT {GIT_CHERRYPICK_OPTIONS_VERSION, 0, GIT_MERGE_OPTIONS_INIT, GIT_CHECKOUT_OPTIONS_INIT}
/**
* Initializes a `git_cherry_pick_options` with default values. Equivalent to
* creating an instance with GIT_CHERRY_PICK_OPTIONS_INIT.
* Initializes a `git_cherrypick_options` with default values. Equivalent to
* creating an instance with GIT_CHERRYPICK_OPTIONS_INIT.
*
* @param opts the `git_cherry_pick_options` struct to initialize
* @param version Version of struct; pass `GIT_CHERRY_PICK_OPTIONS_VERSION`
* @param opts the `git_cherrypick_options` struct to initialize
* @param version Version of struct; pass `GIT_CHERRYPICK_OPTIONS_VERSION`
* @return Zero on success; -1 on failure.
*/
GIT_EXTERN(int) git_cherry_pick_init_options(
git_cherry_pick_options *opts,
GIT_EXTERN(int) git_cherrypick_init_options(
git_cherrypick_options *opts,
unsigned int version);
/**
......@@ -53,16 +53,16 @@ GIT_EXTERN(int) git_cherry_pick_init_options(
*
* @param out pointer to store the index result in
* @param repo the repository that contains the given commits
* @param cherry_pick_commit the commit to cherry-pick
* @param cherrypick_commit the commit to cherry-pick
* @param our_commit the commit to revert against (eg, HEAD)
* @param mainline the parent of the revert commit, if it is a merge
* @param merge_options the merge options (or null for defaults)
* @return zero on success, -1 on failure.
*/
GIT_EXTERN(int) git_cherry_pick_commit(
GIT_EXTERN(int) git_cherrypick_commit(
git_index **out,
git_repository *repo,
git_commit *cherry_pick_commit,
git_commit *cherrypick_commit,
git_commit *our_commit,
unsigned int mainline,
const git_merge_options *merge_options);
......@@ -72,13 +72,13 @@ GIT_EXTERN(int) git_cherry_pick_commit(
*
* @param repo the repository to cherry-pick
* @param commit the commit to cherry-pick
* @param cherry_pick_options the cherry-pick options (or null for defaults)
* @param cherrypick_options the cherry-pick options (or null for defaults)
* @return zero on success, -1 on failure.
*/
GIT_EXTERN(int) git_cherry_pick(
GIT_EXTERN(int) git_cherrypick(
git_repository *repo,
git_commit *commit,
const git_cherry_pick_options *cherry_pick_options);
const git_cherrypick_options *cherrypick_options);
/** @} */
GIT_END_DECL
......
......@@ -662,7 +662,7 @@ typedef enum {
GIT_REPOSITORY_STATE_NONE,
GIT_REPOSITORY_STATE_MERGE,
GIT_REPOSITORY_STATE_REVERT,
GIT_REPOSITORY_STATE_CHERRY_PICK,
GIT_REPOSITORY_STATE_CHERRYPICK,
GIT_REPOSITORY_STATE_BISECT,
GIT_REPOSITORY_STATE_REBASE,
GIT_REPOSITORY_STATE_REBASE_INTERACTIVE,
......
......@@ -17,9 +17,9 @@
#include "git2/commit.h"
#include "git2/sys/commit.h"
#define GIT_CHERRY_PICK_FILE_MODE 0666
#define GIT_CHERRYPICK_FILE_MODE 0666
static int write_cherry_pick_head(
static int write_cherrypick_head(
git_repository *repo,
const char *commit_oidstr)
{
......@@ -27,8 +27,8 @@ static int write_cherry_pick_head(
git_buf file_path = GIT_BUF_INIT;
int error = 0;
if ((error = git_buf_joinpath(&file_path, repo->path_repository, GIT_CHERRY_PICK_HEAD_FILE)) >= 0 &&
(error = git_filebuf_open(&file, file_path.ptr, GIT_FILEBUF_FORCE, GIT_CHERRY_PICK_FILE_MODE)) >= 0 &&
if ((error = git_buf_joinpath(&file_path, repo->path_repository, GIT_CHERRYPICK_HEAD_FILE)) >= 0 &&
(error = git_filebuf_open(&file, file_path.ptr, GIT_FILEBUF_FORCE, GIT_CHERRYPICK_FILE_MODE)) >= 0 &&
(error = git_filebuf_printf(&file, "%s\n", commit_oidstr)) >= 0)
error = git_filebuf_commit(&file);
......@@ -49,7 +49,7 @@ static int write_merge_msg(
int error = 0;
if ((error = git_buf_joinpath(&file_path, repo->path_repository, GIT_MERGE_MSG_FILE)) < 0 ||
(error = git_filebuf_open(&file, file_path.ptr, GIT_FILEBUF_FORCE, GIT_CHERRY_PICK_FILE_MODE)) < 0 ||
(error = git_filebuf_open(&file, file_path.ptr, GIT_FILEBUF_FORCE, GIT_CHERRYPICK_FILE_MODE)) < 0 ||
(error = git_filebuf_printf(&file, "%s", commit_msg)) < 0)
goto cleanup;
......@@ -64,10 +64,10 @@ cleanup:
return error;
}
static int cherry_pick_normalize_opts(
static int cherrypick_normalize_opts(
git_repository *repo,
git_cherry_pick_options *opts,
const git_cherry_pick_options *given,
git_cherrypick_options *opts,
const git_cherrypick_options *given,
const char *their_label)
{
int error = 0;
......@@ -77,10 +77,10 @@ static int cherry_pick_normalize_opts(
GIT_UNUSED(repo);
if (given != NULL)
memcpy(opts, given, sizeof(git_cherry_pick_options));
memcpy(opts, given, sizeof(git_cherrypick_options));
else {
git_cherry_pick_options default_opts = GIT_CHERRY_PICK_OPTIONS_INIT;
memcpy(opts, &default_opts, sizeof(git_cherry_pick_options));
git_cherrypick_options default_opts = GIT_CHERRYPICK_OPTIONS_INIT;
memcpy(opts, &default_opts, sizeof(git_cherrypick_options));
}
if (!opts->checkout_opts.checkout_strategy)
......@@ -95,14 +95,14 @@ static int cherry_pick_normalize_opts(
return error;
}
static int cherry_pick_state_cleanup(git_repository *repo)
static int cherrypick_state_cleanup(git_repository *repo)
{
const char *state_files[] = { GIT_CHERRY_PICK_HEAD_FILE, GIT_MERGE_MSG_FILE };
const char *state_files[] = { GIT_CHERRYPICK_HEAD_FILE, GIT_MERGE_MSG_FILE };
return git_repository__cleanup_files(repo, state_files, ARRAY_SIZE(state_files));
}
static int cherry_pick_seterr(git_commit *commit, const char *fmt)
static int cherrypick_seterr(git_commit *commit, const char *fmt)
{
char commit_oidstr[GIT_OID_HEXSZ + 1];
......@@ -112,60 +112,60 @@ static int cherry_pick_seterr(git_commit *commit, const char *fmt)
return -1;
}
int git_cherry_pick_commit(
int git_cherrypick_commit(
git_index **out,
git_repository *repo,
git_commit *cherry_pick_commit,
git_commit *cherrypick_commit,
git_commit *our_commit,
unsigned int mainline,
const git_merge_options *merge_opts)
{
git_commit *parent_commit = NULL;
git_tree *parent_tree = NULL, *our_tree = NULL, *cherry_pick_tree = NULL;
git_tree *parent_tree = NULL, *our_tree = NULL, *cherrypick_tree = NULL;
int parent = 0, error = 0;
assert(out && repo && cherry_pick_commit && our_commit);
assert(out && repo && cherrypick_commit && our_commit);
if (git_commit_parentcount(cherry_pick_commit) > 1) {
if (git_commit_parentcount(cherrypick_commit) > 1) {
if (!mainline)
return cherry_pick_seterr(cherry_pick_commit,
return cherrypick_seterr(cherrypick_commit,
"Mainline branch is not specified but %s is a merge commit");
parent = mainline;
} else {
if (mainline)
return cherry_pick_seterr(cherry_pick_commit,
return cherrypick_seterr(cherrypick_commit,
"Mainline branch specified but %s is not a merge commit");
parent = git_commit_parentcount(cherry_pick_commit);
parent = git_commit_parentcount(cherrypick_commit);
}
if (parent &&
((error = git_commit_parent(&parent_commit, cherry_pick_commit, (parent - 1))) < 0 ||
((error = git_commit_parent(&parent_commit, cherrypick_commit, (parent - 1))) < 0 ||
(error = git_commit_tree(&parent_tree, parent_commit)) < 0))
goto done;
if ((error = git_commit_tree(&cherry_pick_tree, cherry_pick_commit)) < 0 ||
if ((error = git_commit_tree(&cherrypick_tree, cherrypick_commit)) < 0 ||
(error = git_commit_tree(&our_tree, our_commit)) < 0)
goto done;
error = git_merge_trees(out, repo, parent_tree, our_tree, cherry_pick_tree, merge_opts);
error = git_merge_trees(out, repo, parent_tree, our_tree, cherrypick_tree, merge_opts);
done:
git_tree_free(parent_tree);
git_tree_free(our_tree);
git_tree_free(cherry_pick_tree);
git_tree_free(cherrypick_tree);
git_commit_free(parent_commit);
return error;
}
int git_cherry_pick(
int git_cherrypick(
git_repository *repo,
git_commit *commit,
const git_cherry_pick_options *given_opts)
const git_cherrypick_options *given_opts)
{
git_cherry_pick_options opts;
git_cherrypick_options opts;
git_reference *our_ref = NULL;
git_commit *our_commit = NULL;
char commit_oidstr[GIT_OID_HEXSZ + 1];
......@@ -176,7 +176,7 @@ int git_cherry_pick(
assert(repo && commit);
GITERR_CHECK_VERSION(given_opts, GIT_CHERRY_PICK_OPTIONS_VERSION, "git_cherry_pick_options");
GITERR_CHECK_VERSION(given_opts, GIT_CHERRYPICK_OPTIONS_VERSION, "git_cherrypick_options");
if ((error = git_repository__ensure_not_bare(repo, "cherry-pick")) < 0)
return error;
......@@ -191,11 +191,11 @@ int git_cherry_pick(
if ((error = write_merge_msg(repo, commit_msg)) < 0 ||
(error = git_buf_printf(&their_label, "%.7s... %s", commit_oidstr, commit_summary)) < 0 ||
(error = cherry_pick_normalize_opts(repo, &opts, given_opts, git_buf_cstr(&their_label))) < 0 ||
(error = write_cherry_pick_head(repo, commit_oidstr)) < 0 ||
(error = cherrypick_normalize_opts(repo, &opts, given_opts, git_buf_cstr(&their_label))) < 0 ||
(error = write_cherrypick_head(repo, commit_oidstr)) < 0 ||
(error = git_repository_head(&our_ref, repo)) < 0 ||
(error = git_reference_peel((git_object **)&our_commit, our_ref, GIT_OBJ_COMMIT)) < 0 ||
(error = git_cherry_pick_commit(&index_new, repo, commit, our_commit, opts.mainline, &opts.merge_opts)) < 0 ||
(error = git_cherrypick_commit(&index_new, repo, commit, our_commit, opts.mainline, &opts.merge_opts)) < 0 ||
(error = git_merge__check_result(repo, index_new)) < 0 ||
(error = git_merge__append_conflicts_to_merge_msg(repo, index_new)) < 0 ||
(error = git_checkout_index(repo, index_new, &opts.checkout_opts)) < 0)
......@@ -203,7 +203,7 @@ int git_cherry_pick(
goto done;
on_error:
cherry_pick_state_cleanup(repo);
cherrypick_state_cleanup(repo);
done:
git_index_free(index_new);
......@@ -214,10 +214,10 @@ done:
return error;
}
int git_cherry_pick_init_options(
git_cherry_pick_options *opts, unsigned int version)
int git_cherrypick_init_options(
git_cherrypick_options *opts, unsigned int version)
{
GIT_INIT_STRUCTURE_FROM_TEMPLATE(
opts, version, git_cherry_pick_options, GIT_CHERRY_PICK_OPTIONS_INIT);
opts, version, git_cherrypick_options, GIT_CHERRYPICK_OPTIONS_INIT);
return 0;
}
......@@ -35,7 +35,7 @@
#define GIT_FETCH_HEAD_FILE "FETCH_HEAD"
#define GIT_MERGE_HEAD_FILE "MERGE_HEAD"
#define GIT_REVERT_HEAD_FILE "REVERT_HEAD"
#define GIT_CHERRY_PICK_HEAD_FILE "CHERRY_PICK_HEAD"
#define GIT_CHERRYPICK_HEAD_FILE "CHERRY_PICK_HEAD"
#define GIT_BISECT_LOG_FILE "BISECT_LOG"
#define GIT_REBASE_MERGE_DIR "rebase-merge/"
#define GIT_REBASE_MERGE_INTERACTIVE_FILE GIT_REBASE_MERGE_DIR "interactive"
......
......@@ -1915,8 +1915,8 @@ int git_repository_state(git_repository *repo)
state = GIT_REPOSITORY_STATE_MERGE;
else if(git_path_contains_file(&repo_path, GIT_REVERT_HEAD_FILE))
state = GIT_REPOSITORY_STATE_REVERT;
else if(git_path_contains_file(&repo_path, GIT_CHERRY_PICK_HEAD_FILE))
state = GIT_REPOSITORY_STATE_CHERRY_PICK;
else if(git_path_contains_file(&repo_path, GIT_CHERRYPICK_HEAD_FILE))
state = GIT_REPOSITORY_STATE_CHERRYPICK;
else if(git_path_contains_file(&repo_path, GIT_BISECT_LOG_FILE))
state = GIT_REPOSITORY_STATE_BISECT;
......@@ -1958,7 +1958,7 @@ static const char *state_files[] = {
GIT_MERGE_MODE_FILE,
GIT_MERGE_MSG_FILE,
GIT_REVERT_HEAD_FILE,
GIT_CHERRY_PICK_HEAD_FILE,
GIT_CHERRYPICK_HEAD_FILE,
GIT_BISECT_LOG_FILE,
GIT_REBASE_MERGE_DIR,
GIT_REBASE_APPLY_DIR,
......
......@@ -39,7 +39,7 @@ void test_cherrypick_bare__automerge(void)
git_oid_fromstr(&cherry_oid, "cfc4f0999a8367568e049af4f72e452d40828a15");
cl_git_pass(git_commit_lookup(&commit, repo, &cherry_oid));
cl_git_pass(git_cherry_pick_commit(&index, repo, commit, head, 0, NULL));
cl_git_pass(git_cherrypick_commit(&index, repo, commit, head, 0, NULL));
cl_assert(merge_test_index(index, merge_index_entries, 3));
git_index_free(index);
......@@ -69,7 +69,7 @@ void test_cherrypick_bare__conflicts(void)
git_oid_fromstr(&cherry_oid, "e9b63f3655b2ad80c0ff587389b5a9589a3a7110");
cl_git_pass(git_commit_lookup(&commit, repo, &cherry_oid));
cl_git_pass(git_cherry_pick_commit(&index, repo, commit, head, 0, NULL));
cl_git_pass(git_cherrypick_commit(&index, repo, commit, head, 0, NULL));
cl_assert(merge_test_index(index, merge_index_entries, 7));
git_index_free(index);
......@@ -96,7 +96,7 @@ void test_cherrypick_bare__orphan(void)
git_oid_fromstr(&cherry_oid, "74f06b5bfec6d33d7264f73606b57a7c0b963819");
cl_git_pass(git_commit_lookup(&commit, repo, &cherry_oid));
cl_git_pass(git_cherry_pick_commit(&index, repo, commit, head, 0, NULL));
cl_git_pass(git_cherrypick_commit(&index, repo, commit, head, 0, NULL));
cl_assert(merge_test_index(index, merge_index_entries, 4));
git_index_free(index);
......
......@@ -36,7 +36,7 @@ void test_cherrypick_workdir__automerge(void)
git_signature *signature = NULL;
size_t i;
const char *cherry_pick_oids[] = {
const char *cherrypick_oids[] = {
"cfc4f0999a8367568e049af4f72e452d40828a15",
"964ea3da044d9083181a88ba6701de9e35778bf4",
"a43a050c588d4e92f11a6b139680923e9728477d",
......@@ -62,29 +62,29 @@ void test_cherrypick_workdir__automerge(void)
for (i = 0; i < 3; ++i) {
git_commit *head = NULL, *commit = NULL;
git_oid cherry_oid, cherry_picked_oid, cherry_picked_tree_oid;
git_tree *cherry_picked_tree = NULL;
git_oid cherry_oid, cherrypicked_oid, cherrypicked_tree_oid;
git_tree *cherrypicked_tree = NULL;
cl_git_pass(git_commit_lookup(&head, repo, &head_oid));
cl_git_pass(git_reset(repo, (git_object *)head, GIT_RESET_HARD, NULL, NULL));
git_oid_fromstr(&cherry_oid, cherry_pick_oids[i]);
git_oid_fromstr(&cherry_oid, cherrypick_oids[i]);
cl_git_pass(git_commit_lookup(&commit, repo, &cherry_oid));
cl_git_pass(git_cherry_pick(repo, commit, NULL));
cl_git_pass(git_cherrypick(repo, commit, NULL));
cl_assert(git_path_exists(TEST_REPO_PATH "/.git/CHERRY_PICK_HEAD"));
cl_assert(git_path_exists(TEST_REPO_PATH "/.git/MERGE_MSG"));
cl_git_pass(git_index_write_tree(&cherry_picked_tree_oid, repo_index));
cl_git_pass(git_tree_lookup(&cherry_picked_tree, repo, &cherry_picked_tree_oid));
cl_git_pass(git_commit_create(&cherry_picked_oid, repo, "HEAD", signature, signature, NULL,
"Cherry picked!", cherry_picked_tree, 1, (const git_commit **)&head));
cl_git_pass(git_index_write_tree(&cherrypicked_tree_oid, repo_index));
cl_git_pass(git_tree_lookup(&cherrypicked_tree, repo, &cherrypicked_tree_oid));
cl_git_pass(git_commit_create(&cherrypicked_oid, repo, "HEAD", signature, signature, NULL,
"Cherry picked!", cherrypicked_tree, 1, (const git_commit **)&head));
cl_assert(merge_test_index(repo_index, merge_index_entries + i * 3, 3));
git_oid_cpy(&head_oid, &cherry_picked_oid);
git_oid_cpy(&head_oid, &cherrypicked_oid);
git_tree_free(cherry_picked_tree);
git_tree_free(cherrypicked_tree);
git_commit_free(head);
git_commit_free(commit);
}
......@@ -118,7 +118,7 @@ void test_cherrypick_workdir__conflicts(void)
git_oid_fromstr(&cherry_oid, "e9b63f3655b2ad80c0ff587389b5a9589a3a7110");
cl_git_pass(git_commit_lookup(&commit, repo, &cherry_oid));
cl_git_pass(git_cherry_pick(repo, commit, NULL));
cl_git_pass(git_cherrypick(repo, commit, NULL));
cl_assert(git_path_exists(TEST_REPO_PATH "/.git/CHERRY_PICK_HEAD"));
cl_assert(git_path_exists(TEST_REPO_PATH "/.git/MERGE_MSG"));
......@@ -198,7 +198,7 @@ void test_cherrypick_workdir__conflict_use_ours(void)
{
git_commit *head = NULL, *commit = NULL;
git_oid head_oid, cherry_oid;
git_cherry_pick_options opts = GIT_CHERRY_PICK_OPTIONS_INIT;
git_cherrypick_options opts = GIT_CHERRYPICK_OPTIONS_INIT;
struct merge_index_entry merge_index_entries[] = {
{ 0100644, "242e7977ba73637822ffb265b46004b9b0e5153b", 0, "file1.txt" },
......@@ -226,7 +226,7 @@ void test_cherrypick_workdir__conflict_use_ours(void)
git_oid_fromstr(&cherry_oid, "e9b63f3655b2ad80c0ff587389b5a9589a3a7110");
cl_git_pass(git_commit_lookup(&commit, repo, &cherry_oid));
cl_git_pass(git_cherry_pick(repo, commit, &opts));
cl_git_pass(git_cherrypick(repo, commit, &opts));
cl_assert(merge_test_index(repo_index, merge_index_entries, 7));
cl_assert(merge_test_workdir(repo, merge_filesystem_entries, 3));
......@@ -235,7 +235,7 @@ void test_cherrypick_workdir__conflict_use_ours(void)
opts.merge_opts.file_favor = GIT_MERGE_FILE_FAVOR_OURS;
cl_git_pass(git_reset(repo, (git_object *)head, GIT_RESET_HARD, NULL, NULL));
cl_git_pass(git_cherry_pick(repo, commit, &opts));
cl_git_pass(git_cherrypick(repo, commit, &opts));
cl_assert(merge_test_index(repo_index, merge_filesystem_entries, 3));
cl_assert(merge_test_workdir(repo, merge_filesystem_entries, 3));
......@@ -251,7 +251,7 @@ void test_cherrypick_workdir__rename(void)
{
git_commit *head, *commit;
git_oid head_oid, cherry_oid;
git_cherry_pick_options opts = GIT_CHERRY_PICK_OPTIONS_INIT;
git_cherrypick_options opts = GIT_CHERRYPICK_OPTIONS_INIT;
struct merge_index_entry merge_index_entries[] = {
{ 0100644, "19c5c7207054604b69c84d08a7571ef9672bb5c2", 0, "file1.txt" },
......@@ -268,7 +268,7 @@ void test_cherrypick_workdir__rename(void)
git_oid_fromstr(&cherry_oid, "2a26c7e88b285613b302ba76712bc998863f3cbc");
cl_git_pass(git_commit_lookup(&commit, repo, &cherry_oid));
cl_git_pass(git_cherry_pick(repo, commit, &opts));
cl_git_pass(git_cherrypick(repo, commit, &opts));
cl_assert(merge_test_index(repo_index, merge_index_entries, 3));
......@@ -284,7 +284,7 @@ void test_cherrypick_workdir__both_renamed(void)
git_commit *head, *commit;
git_oid head_oid, cherry_oid;
git_buf mergemsg_buf = GIT_BUF_INIT;
git_cherry_pick_options opts = GIT_CHERRY_PICK_OPTIONS_INIT;
git_cherrypick_options opts = GIT_CHERRYPICK_OPTIONS_INIT;
struct merge_index_entry merge_index_entries[] = {
{ 0100644, "19c5c7207054604b69c84d08a7571ef9672bb5c2", 0, "file1.txt" },
......@@ -303,7 +303,7 @@ void test_cherrypick_workdir__both_renamed(void)
git_oid_fromstr(&cherry_oid, "2a26c7e88b285613b302ba76712bc998863f3cbc");
cl_git_pass(git_commit_lookup(&commit, repo, &cherry_oid));
cl_git_pass(git_cherry_pick(repo, commit, &opts));
cl_git_pass(git_cherrypick(repo, commit, &opts));
cl_assert(merge_test_index(repo_index, merge_index_entries, 5));
......@@ -326,13 +326,13 @@ void test_cherrypick_workdir__nonmerge_fails_mainline_specified(void)
{
git_reference *head;
git_commit *commit;
git_cherry_pick_options opts = GIT_CHERRY_PICK_OPTIONS_INIT;
git_cherrypick_options opts = GIT_CHERRYPICK_OPTIONS_INIT;
cl_git_pass(git_repository_head(&head, repo));
cl_git_pass(git_reference_peel((git_object **)&commit, head, GIT_OBJ_COMMIT));
opts.mainline = 1;
cl_must_fail(git_cherry_pick(repo, commit, &opts));
cl_must_fail(git_cherrypick(repo, commit, &opts));
cl_assert(!git_path_exists(TEST_REPO_PATH "/.git/CHERRY_PICK_HEAD"));
cl_assert(!git_path_exists(TEST_REPO_PATH "/.git/MERGE_MSG"));
......@@ -355,7 +355,7 @@ void test_cherrypick_workdir__merge_fails_without_mainline_specified(void)
git_oid_fromstr(&cherry_oid, "abe4603bc7cd5b8167a267e0e2418fd2348f8cff");
cl_git_pass(git_commit_lookup(&commit, repo, &cherry_oid));
cl_must_fail(git_cherry_pick(repo, commit, NULL));
cl_must_fail(git_cherrypick(repo, commit, NULL));
cl_assert(!git_path_exists(TEST_REPO_PATH "/.git/CHERRY_PICK_HEAD"));
cl_assert(!git_path_exists(TEST_REPO_PATH "/.git/MERGE_MSG"));
......@@ -370,7 +370,7 @@ void test_cherrypick_workdir__merge_first_parent(void)
{
git_commit *head, *commit;
git_oid head_oid, cherry_oid;
git_cherry_pick_options opts = GIT_CHERRY_PICK_OPTIONS_INIT;
git_cherrypick_options opts = GIT_CHERRYPICK_OPTIONS_INIT;
struct merge_index_entry merge_index_entries[] = {
{ 0100644, "f90f9dcbdac2cce5cc166346160e19cb693ef4e8", 0, "file1.txt" },
......@@ -387,7 +387,7 @@ void test_cherrypick_workdir__merge_first_parent(void)
git_oid_fromstr(&cherry_oid, "abe4603bc7cd5b8167a267e0e2418fd2348f8cff");
cl_git_pass(git_commit_lookup(&commit, repo, &cherry_oid));
cl_git_pass(git_cherry_pick(repo, commit, &opts));
cl_git_pass(git_cherrypick(repo, commit, &opts));
cl_assert(merge_test_index(repo_index, merge_index_entries, 3));
......@@ -402,7 +402,7 @@ void test_cherrypick_workdir__merge_second_parent(void)
{
git_commit *head, *commit;
git_oid head_oid, cherry_oid;
git_cherry_pick_options opts = GIT_CHERRY_PICK_OPTIONS_INIT;
git_cherrypick_options opts = GIT_CHERRYPICK_OPTIONS_INIT;
struct merge_index_entry merge_index_entries[] = {
{ 0100644, "487434cace79238a7091e2220611d4f20a765690", 0, "file1.txt" },
......@@ -419,7 +419,7 @@ void test_cherrypick_workdir__merge_second_parent(void)
git_oid_fromstr(&cherry_oid, "abe4603bc7cd5b8167a267e0e2418fd2348f8cff");
cl_git_pass(git_commit_lookup(&commit, repo, &cherry_oid));
cl_git_pass(git_cherry_pick(repo, commit, &opts));
cl_git_pass(git_cherrypick(repo, commit, &opts));
cl_assert(merge_test_index(repo_index, merge_index_entries, 3));
......
......@@ -59,8 +59,8 @@ void test_repo_state__revert(void)
void test_repo_state__cherry_pick(void)
{
setup_simple_state(GIT_CHERRY_PICK_HEAD_FILE);
assert_repo_state(GIT_REPOSITORY_STATE_CHERRY_PICK);
setup_simple_state(GIT_CHERRYPICK_HEAD_FILE);
assert_repo_state(GIT_REPOSITORY_STATE_CHERRYPICK);
cl_git_pass(git_repository_state_cleanup(_repo));
assert_repo_state(GIT_REPOSITORY_STATE_NONE);
}
......
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