Method: Rugged::Rebase.new
- Defined in:
- ext/rugged/rugged_rebase.c
.new(repo, branch, upstream[, onto][, options]) ⇒ Object
Initialize a new rebase operation. This will put repo
in a rebase state.
branch
is the branch to be rebased, and upstream
is the branch which is to be the new base. If onto
is specified, this will be the one base, and upstream
is used to determine which commits from branch
to use for the rebase.
You can pass merge and checkout options for the options hash, plus a few rebase-specific ones:
- :quiet
-
If true, a flag will be set to ask tools to activate quiet mode. This does not do anything for libgit2/rugged but can be used to interact with other implementations.
- :inmemory
-
Do not put the repository in a rebase state but perform all the operations in-memory. In case of conflicts, the rebase operation Hash returned by #next will contain the index which can be used to resolve conflicts.
- :rewrite_notes_ref
-
Name of the notes reference used to rewrite notes for rebased commits when finishing the rebase. If
nil
, it will be taken from the configuration.
145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 |
# File 'ext/rugged/rugged_rebase.c', line 145
static VALUE rb_git_rebase_new(int argc, VALUE* argv, VALUE klass)
{
int error = 0, exception = 0;
git_rebase *rebase = NULL;
git_repository *repo;
git_annotated_commit *branch = NULL, *upstream = NULL, *onto = NULL;
VALUE rb_repo, rb_branch, rb_upstream, rb_onto, rb_options;
git_rebase_options options = GIT_REBASE_OPTIONS_INIT;
rb_scan_args(argc, argv, "31:", &rb_repo, &rb_branch, &rb_upstream, &rb_onto, &rb_options);
Data_Get_Struct(rb_repo, git_repository, repo);
if ((exception = rugged_get_annotated_commit(&branch, rb_repo, rb_branch)))
goto cleanup;
if ((exception = rugged_get_annotated_commit(&upstream, rb_repo, rb_upstream)))
goto cleanup;
if (!NIL_P(rb_onto)) {
if ((exception = rugged_get_annotated_commit(&onto, rb_repo, rb_onto)))
goto cleanup;
}
parse_rebase_options(&options, rb_options);
error = git_rebase_init(&rebase, repo, branch, upstream, onto, &options);
cleanup:
git_annotated_commit_free(branch);
git_annotated_commit_free(upstream);
git_annotated_commit_free(onto);
if (exception)
rb_jump_tag(exception);
rugged_exception_check(error);
return rugged_rebase_new(klass, rb_repo, rebase);
}
|