ext/rugged/rugged_rebase.c in rugged-0.25.0b2 vs ext/rugged/rugged_rebase.c in rugged-0.25.0b3

- old
+ new

@@ -126,11 +126,11 @@ return exception; } /* * call-seq: - * Rebase.new(repo, branch, upstream[, onto][, options]) -> Rebase + * Rebase.new(repo, branch, upstream[, onto][, options]) -> new_rebase * * 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 @@ -146,12 +146,12 @@ * 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 RebaseOperation - * returned by #next will contain the index which can be used to + * 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 @@ -187,16 +187,15 @@ cleanup: git_annotated_commit_free(branch); git_annotated_commit_free(upstream); git_annotated_commit_free(onto); - if (error) { - rugged_exception_check(error); - } else if (exception) { + if (exception) rb_jump_tag(exception); - } + rugged_exception_check(error); + return rugged_rebase_new(klass, rb_repo, rebase); } /* * call-seq: @@ -250,11 +249,11 @@ return hash; } /* * call-seq: - * Rebase.inmemory_index -> Index + * rebase.inmemory_index -> index * * Gets the index produced by the last operation, which is the result * of +next+ and which will be committed by the next invocation of * +commit+. This is useful for resolving conflicts in an in-memory * rebase before committing them. @@ -274,16 +273,19 @@ return rugged_index_new(rb_cRuggedIndex, self, index); } /* * call-seq: - * Rebase.commit(author = nil, committer, message = nil) + * rebase.commit(author: nil, committer: committer, message: nil) -> oid or nil * * Commit the current patch. Any conflicts must have been resolved. * * If +author+ is +nil+, the existing author for the commit will be * used. If +message+ is +nil+, the existing message will be used. + * + * Returns a string containing the oid of the newly created commit, + * or +nil+ if there are no changes to be committed. */ static VALUE rb_git_rebase_commit(int argc, VALUE *argv, VALUE self) { int error; git_oid id; @@ -316,18 +318,23 @@ error = git_rebase_commit(&id, rebase, author, committer, NULL, message); git_signature_free(author); git_signature_free(committer); + if (error == GIT_EAPPLIED) { + giterr_clear(); + return Qnil; + } + rugged_exception_check(error); return rugged_create_oid(&id); } /* * call-seq: - * Rebase.abort() + * rebase.abort -> nil * * Abort the rebase currently in process, resetting the repository * and working directory to their state before the rebase began. */ static VALUE rb_git_rebase_abort(VALUE self) @@ -340,10 +347,10 @@ return Qnil; } /* * call-seq: - * Rebase.finish() + * rebase.finish -> nil * * Finish the rebase currently in progress once all patches have been * applied. */ static VALUE rb_git_rebase_finish(VALUE self, VALUE rb_sig)