Method: Rugged::Repository#cherrypick
- Defined in:
- ext/rugged/rugged_repo.c
permalink #cherrypick(commit[, options]) ⇒ nil
Cherry-pick the given commit and update the index and working directory accordingly.
‘commit` can be either a string containing a commit id or a `Rugged::Commit` object.
The following options can be passed in the options
Hash:
- :mainline
-
When cherry-picking a merge, you need to specify the parent number (starting from 1) which should be considered the mainline.
2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 |
# File 'ext/rugged/rugged_repo.c', line 2653
static VALUE rb_git_repo_cherrypick(int argc, VALUE *argv, VALUE self)
{
VALUE rb_options, rb_commit;
git_repository *repo;
git_commit *commit;
git_cherrypick_options opts = GIT_CHERRYPICK_OPTIONS_INIT;
int error;
rb_scan_args(argc, argv, "10:", &rb_commit, &rb_options);
if (TYPE(rb_commit) == T_STRING) {
rb_commit = rugged_object_rev_parse(self, rb_commit, 1);
}
if (!rb_obj_is_kind_of(rb_commit, rb_cRuggedCommit)) {
rb_raise(rb_eArgError, "Expected a Rugged::Commit.");
}
Data_Get_Struct(self, git_repository, repo);
TypedData_Get_Struct(rb_commit, git_commit, &rugged_object_type, commit);
rugged_parse_cherrypick_options(&opts, rb_options);
error = git_cherrypick(repo, commit, &opts);
rugged_exception_check(error);
return Qnil;
}
|