summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2014-07-22 10:40:23 -0400
committerEdward Thomson <ethomson@edwardthomson.com>2014-07-22 10:40:23 -0400
commit0ba4dca52625b54d6b741bd10dce5ef76ebbf1b8 (patch)
treedfc1be8e3b7b1516eb7103aaecca7644cfc17d50 /src
parent091165c53b2bcd5d41fb71d43ed5a23a3d96bf5d (diff)
downloadlibgit2-0ba4dca52625b54d6b741bd10dce5ef76ebbf1b8.tar.gz
git_cherry_pick -> git_cherrypick
Diffstat (limited to 'src')
-rw-r--r--src/cherrypick.c74
-rw-r--r--src/refs.h2
-rw-r--r--src/repository.c6
3 files changed, 41 insertions, 41 deletions
diff --git a/src/cherrypick.c b/src/cherrypick.c
index cdc0eaac2..e58d0ab4c 100644
--- a/src/cherrypick.c
+++ b/src/cherrypick.c
@@ -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;
}
diff --git a/src/refs.h b/src/refs.h
index a46b219b6..2e79bdfca 100644
--- a/src/refs.h
+++ b/src/refs.h
@@ -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"
diff --git a/src/repository.c b/src/repository.c
index e8d50aed3..4f7a5feab 100644
--- a/src/repository.c
+++ b/src/repository.c
@@ -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,