int git_signature_new(git_signature **sig_out, const char *name, const char *email, git_time_t time, int offset) { git_signature *p = NULL; assert(name && email); *sig_out = NULL; p = git__calloc(1, sizeof(git_signature)); GITERR_CHECK_ALLOC(p); if (process_trimming(name, &p->name, name + strlen(name), 1) < 0 || process_trimming(email, &p->email, email + strlen(email), 1) < 0) { git_signature_free(p); return -1; } if (contains_angle_brackets(p->email) || contains_angle_brackets(p->name)) { git_signature_free(p); return signature_error("Neither `name` nor `email` should contain angle brackets chars."); } p->when.time = time; p->when.offset = offset; *sig_out = p; return 0; }
/** * Remove the note for an object * * @param note S4 class git_note * @param author Signature of the notes commit author * @param committer Signature of the notes commit committer * @return R_NilValue */ SEXP git2r_note_remove(SEXP note, SEXP author, SEXP committer) { int err; SEXP repo; SEXP annotated; git_oid note_oid; git_signature *sig_author = NULL; git_signature *sig_committer = NULL; git_repository *repository = NULL; if (git2r_arg_check_note(note)) git2r_error(git2r_err_note_arg, __func__, "note"); if (git2r_arg_check_signature(author)) git2r_error(git2r_err_signature_arg, __func__, "author"); if (git2r_arg_check_signature(committer)) git2r_error(git2r_err_signature_arg, __func__, "committer"); repo = GET_SLOT(note, Rf_install("repo")); repository = git2r_repository_open(repo); if (!repository) git2r_error(git2r_err_invalid_repository, __func__, NULL); err = git2r_signature_from_arg(&sig_author, author); if (GIT_OK != err) goto cleanup; err = git2r_signature_from_arg(&sig_committer, committer); if (GIT_OK != err) goto cleanup; annotated = GET_SLOT(note, Rf_install("annotated")); err = git_oid_fromstr(¬e_oid, CHAR(STRING_ELT(annotated, 0))); if (GIT_OK != err) goto cleanup; err = git_note_remove( repository, CHAR(STRING_ELT(GET_SLOT(note, Rf_install("refname")), 0)), sig_author, sig_committer, ¬e_oid); cleanup: if (sig_author) git_signature_free(sig_author); if (sig_committer) git_signature_free(sig_committer); if (repository) git_repository_free(repository); if (GIT_OK != err) git2r_error(git2r_err_from_libgit2, __func__, giterr_last()->message); return R_NilValue; }
static void assert_commit_parses(const char *data, size_t datalen, const char *expected_treeid, const char *expected_author, const char *expected_committer, const char *expected_encoding, const char *expected_message, size_t expected_parents) { git_commit *commit; if (!datalen) datalen = strlen(data); cl_git_pass(git_object__from_raw((git_object **) &commit, data, datalen, GIT_OBJECT_COMMIT)); if (expected_author) { git_signature *author; cl_git_pass(git_signature_from_buffer(&author, expected_author)); cl_assert(git_signature__equal(author, commit->author)); cl_assert_equal_s(author->name, commit->author->name); cl_assert_equal_s(author->email, commit->author->email); cl_assert_equal_i(author->when.time, commit->author->when.time); cl_assert_equal_i(author->when.offset, commit->author->when.offset); cl_assert_equal_i(author->when.sign, commit->author->when.sign); git_signature_free(author); } if (expected_committer) { git_signature *committer; cl_git_pass(git_signature_from_buffer(&committer, expected_committer)); cl_assert_equal_s(committer->name, commit->committer->name); cl_assert_equal_s(committer->email, commit->committer->email); cl_assert_equal_i(committer->when.time, commit->committer->when.time); cl_assert_equal_i(committer->when.offset, commit->committer->when.offset); cl_assert_equal_i(committer->when.sign, commit->committer->when.sign); git_signature_free(committer); } if (expected_encoding) cl_assert_equal_s(commit->message_encoding, expected_encoding); else cl_assert_equal_p(commit->message_encoding, NULL); if (expected_message) cl_assert_equal_s(commit->raw_message, expected_message); else cl_assert_equal_p(commit->message_encoding, NULL); if (expected_treeid) { git_oid tree_oid; cl_git_pass(git_oid_fromstr(&tree_oid, expected_treeid)); cl_assert_equal_oid(&tree_oid, &commit->tree_id); } cl_assert_equal_i(commit->parent_ids.size, expected_parents); git_object__free(&commit->object); }
void git_note_free(git_note *note) { if (note == NULL) return; git_signature_free(note->committer); git_signature_free(note->author); git__free(note->message); git__free(note); }
// write a new commit object from memory to disk void test_commit_write__from_memory(void) { git_oid tree_id, parent_id, commit_id; git_signature *author, *committer; const git_signature *author1, *committer1; git_commit *parent; git_tree *tree; const char *commit_id_str = "8496071c1b46c854b31185ea97743be6a8774479"; git_oid_fromstr(&tree_id, tree_oid); cl_git_pass(git_tree_lookup(&tree, g_repo, &tree_id)); git_oid_fromstr(&parent_id, commit_id_str); cl_git_pass(git_commit_lookup(&parent, g_repo, &parent_id)); /* create signatures */ cl_git_pass(git_signature_new(&committer, committer_name, committer_email, 123456789, 60)); cl_git_pass(git_signature_new(&author, committer_name, committer_email, 987654321, 90)); cl_git_pass(git_commit_create_v( &commit_id, /* out id */ g_repo, NULL, /* do not update the HEAD */ author, committer, NULL, commit_message, tree, 1, parent)); git_object_free((git_object *)parent); git_object_free((git_object *)tree); git_signature_free(committer); git_signature_free(author); cl_git_pass(git_commit_lookup(&commit, g_repo, &commit_id)); /* Check attributes were set correctly */ author1 = git_commit_author(commit); cl_assert(author1 != NULL); cl_assert_equal_s(committer_name, author1->name); cl_assert_equal_s(committer_email, author1->email); cl_assert(author1->when.time == 987654321); cl_assert(author1->when.offset == 90); committer1 = git_commit_committer(commit); cl_assert(committer1 != NULL); cl_assert_equal_s(committer_name, committer1->name); cl_assert_equal_s(committer_email, committer1->email); cl_assert(committer1->when.time == 123456789); cl_assert(committer1->when.offset == 60); cl_assert_equal_s(commit_message, git_commit_message(commit)); }
void git_commit__free(git_commit *commit) { clear_parents(commit); git_signature_free(commit->author); git_signature_free(commit->committer); free(commit->message); free(commit->message_short); free(commit); }
void git_commit__free(git_commit *commit) { clear_parents(commit); git_vector_free(&commit->parent_oids); git_signature_free(commit->author); git_signature_free(commit->committer); free(commit->message); free(commit->message_encoding); free(commit); }
/* * call-seq: * obj.remove_note(data = {}) -> boolean * * Removes a +note+ from +object+, with the given +data+ * arguments, passed as a +Hash+: * * - +:committer+ (optional): a hash with the signature for the committer, * defaults to the signature from the configuration * - +:author+ (optional): a hash with the signature for the author, * defaults to the signature from the configuration * - +:ref+: (optional): canonical name of the reference to use, defaults to "refs/notes/commits" * * When the note is successfully removed +true+ will be * returned as a +Boolean+. * * author = {:email=>"*****@*****.**", :time=>Time.now, :name=>"Vicent Mart\303\255"} * * obj.remove_note( * :author => author, * :committer => author, * :ref => 'refs/notes/builds' * ) */ static VALUE rb_git_note_remove(int argc, VALUE *argv, VALUE self) { int error = 0; const char *notes_ref = NULL; git_repository *repo = NULL; git_signature *author, *committer; git_object *target = NULL; VALUE rb_data; VALUE rb_ref = Qnil; VALUE rb_author = Qnil; VALUE rb_committer = Qnil; VALUE owner; Data_Get_Struct(self, git_object, target); owner = rugged_owner(self); Data_Get_Struct(owner, git_repository, repo); rb_scan_args(argc, argv, "01", &rb_data); if (!NIL_P(rb_data)) { Check_Type(rb_data, T_HASH); rb_ref = rb_hash_aref(rb_data, CSTR2SYM("ref")); if (!NIL_P(rb_ref)) { Check_Type(rb_ref, T_STRING); notes_ref = StringValueCStr(rb_ref); } rb_committer = rb_hash_aref(rb_data, CSTR2SYM("committer")); rb_author = rb_hash_aref(rb_data, CSTR2SYM("author")); } committer = rugged_signature_get(rb_committer, repo); author = rugged_signature_get(rb_author, repo); error = git_note_remove( repo, notes_ref, author, committer, git_object_id(target)); git_signature_free(author); git_signature_free(committer); if (error == GIT_ENOTFOUND) return Qfalse; rugged_exception_check(error); return Qtrue; }
void test_commit_signature__pos_and_neg_zero_offsets_dont_match(void) { git_signature *with_neg_zero; git_signature *with_pos_zero; cl_git_pass(git_signature_from_buffer(&with_neg_zero, "Test User <*****@*****.**> 1461698487 -0000")); cl_git_pass(git_signature_from_buffer(&with_pos_zero, "Test User <*****@*****.**> 1461698487 +0000")); cl_assert(!git_signature__equal(with_neg_zero, with_pos_zero)); git_signature_free((git_signature *)with_neg_zero); git_signature_free((git_signature *)with_pos_zero); }
static void free_commit_options(struct commit_data *commit_data) { int i; git_signature_free(commit_data->author); git_signature_free(commit_data->committer); git_object_free((git_object *)commit_data->tree); for (i = 0; i < commit_data->parent_count; ++i) git_object_free((git_object *) commit_data->parents[i]); xfree(commit_data->parents); }
static void BlameHunk_dealloc(BlameHunk *self) { free(self->final_commit_id); if (self->final_signature) git_signature_free(self->final_signature); free(self->orig_commit_id); if (self->orig_path) free(self->orig_path); if (self->orig_signature) git_signature_free(self->orig_signature); PyObject_Del(self); }
// create a root commit void test_commit_write__root(void) { git_oid tree_id, commit_id; const git_oid *branch_oid; git_signature *author, *committer; const char *branch_name = "refs/heads/root-commit-branch"; git_tree *tree; git_oid_fromstr(&tree_id, tree_oid); cl_git_pass(git_tree_lookup(&tree, g_repo, &tree_id)); /* create signatures */ cl_git_pass(git_signature_new(&committer, committer_name, committer_email, 123456789, 60)); cl_git_pass(git_signature_new(&author, committer_name, committer_email, 987654321, 90)); /* First we need to update HEAD so it points to our non-existant branch */ cl_git_pass(git_reference_lookup(&head, g_repo, "HEAD")); cl_assert(git_reference_type(head) == GIT_REF_SYMBOLIC); head_old = git__strdup(git_reference_symbolic_target(head)); cl_assert(head_old != NULL); git_reference_free(head); cl_git_pass(git_reference_symbolic_create(&head, g_repo, "HEAD", branch_name, 1)); cl_git_pass(git_commit_create_v( &commit_id, /* out id */ g_repo, "HEAD", author, committer, NULL, root_commit_message, tree, 0)); git_object_free((git_object *)tree); git_signature_free(committer); git_signature_free(author); /* * The fact that creating a commit works has already been * tested. Here we just make sure it's our commit and that it was * written as a root commit. */ cl_git_pass(git_commit_lookup(&commit, g_repo, &commit_id)); cl_assert(git_commit_parentcount(commit) == 0); cl_git_pass(git_reference_lookup(&branch, g_repo, branch_name)); branch_oid = git_reference_target(branch); cl_git_pass(git_oid_cmp(branch_oid, &commit_id)); cl_assert_equal_s(root_commit_message, git_commit_message(commit)); }
/* * Needs a table * supported field names: * update_ref * author * committer * message_encoding * message * tree */ int luagi_commit_amend( lua_State *L ) { git_commit** commit = checkcommit( L ); luaL_checktype( L, 2, LUA_TTABLE); // since all elements can be null, we use a table... lua_getfield( L, 2, "update_ref"); const char* update_ref = luaL_optstring( L, -1, NULL ); git_signature* author = NULL; int ret = 0; lua_getfield( L, 2, "author" ); if( lua_istable( L, -1 ) ) { ret = table_to_signature( L, &author, -1 ); } git_signature* committer = NULL; lua_getfield( L, 2, "committer" ); if( lua_istable( L, -1 ) ) { ret = table_to_signature( L, &committer, -1 ); } lua_getfield( L, 2, "message_encoding" ); const char* message_encoding = luaL_optstring( L, -1, NULL ); lua_getfield( L, 2, "message" ); const char* message = luaL_optstring( L, -1, NULL ); lua_getfield( L, 2, "tree" ); git_tree* tree = NULL; if( lua_isuserdata( L, -1 ) ) { tree = *( ( git_tree** ) luaL_checkudata( L, -1, LUAGI_TREE_FUNCS ) ); } // use the table and modify the commit git_oid outid; ret = git_commit_amend( &outid, *commit, update_ref, author, committer, message_encoding, message, tree ); git_signature_free( author ); git_signature_free( committer ); if( ret != 0 ) { lua_pushnil( L ); lua_pushfstring( L, "commit amend failed %d", ret ); return 2; } return luagi_push_oid( L, &outid ); }
void test_repo_head__setting_head_updates_reflog(void) { git_object *tag; git_signature *sig; git_annotated_commit *annotated; cl_git_pass(git_signature_now(&sig, "me", "*****@*****.**")); cl_git_pass(git_repository_set_head(repo, "refs/heads/haacked")); cl_git_pass(git_repository_set_head(repo, "refs/heads/unborn")); cl_git_pass(git_revparse_single(&tag, repo, "tags/test")); cl_git_pass(git_repository_set_head_detached(repo, git_object_id(tag))); cl_git_pass(git_repository_set_head(repo, "refs/heads/haacked")); test_reflog(repo, 2, NULL, "refs/heads/haacked", "*****@*****.**", "checkout: moving from master to haacked"); test_reflog(repo, 1, NULL, "tags/test^{commit}", "*****@*****.**", "checkout: moving from unborn to e90810b8df3e80c413d903f631643c716887138d"); test_reflog(repo, 0, "tags/test^{commit}", "refs/heads/haacked", "*****@*****.**", "checkout: moving from e90810b8df3e80c413d903f631643c716887138d to haacked"); cl_git_pass(git_annotated_commit_from_revspec(&annotated, repo, "haacked~0")); cl_git_pass(git_repository_set_head_detached_from_annotated(repo, annotated)); test_reflog(repo, 0, NULL, "refs/heads/haacked", "*****@*****.**", "checkout: moving from haacked to haacked~0"); git_annotated_commit_free(annotated); git_object_free(tag); git_signature_free(sig); }
PyObject * build_signature(Object *obj, const git_signature *signature, const char *encoding) { Signature *py_signature; py_signature = PyObject_New(Signature, &SignatureType); if (!py_signature) goto on_error; py_signature->encoding = NULL; if (encoding) { py_signature->encoding = strdup(encoding); if (!py_signature->encoding) goto on_error; } Py_XINCREF(obj); py_signature->obj = obj; py_signature->signature = signature; return (PyObject*)py_signature; on_error: git_signature_free((git_signature *) signature); return NULL; }
void test_refs_settargetwithlog__updating_a_direct_reference_adds_a_reflog_entry(void) { git_reference *reference, *reference_out; git_oid current_id, target_id; git_signature *signature; git_reflog *reflog; const git_reflog_entry *entry; const char *message = "You've been logged, mate!"; git_oid_fromstr(¤t_id, br2_tip); git_oid_fromstr(&target_id, master_tip); cl_git_pass(git_reference_lookup(&reference, g_repo, br2_name)); cl_git_pass(git_signature_now(&signature, "foo", "foo@bar")); cl_git_pass(git_reference_set_target( &reference_out, reference, &target_id, signature, message)); cl_git_pass(git_reflog_read(&reflog, g_repo, br2_name)); entry = git_reflog_entry_byindex(reflog, 0); cl_assert(git_oid_cmp(¤t_id, &entry->oid_old) == 0); cl_assert(git_oid_cmp(&target_id, &entry->oid_cur) == 0); cl_assert_equal_s(message, entry->msg); git_reflog_free(reflog); git_reference_free(reference_out); git_reference_free(reference); git_signature_free(signature); }
void test_repo_head__orphan_branch_does_not_count(void) { git_signature *sig; git_oid id; const char *msg; cl_git_pass(git_signature_now(&sig, "me", "*****@*****.**")); /* Have something known */ msg = "message1"; git_oid_fromstr(&id, "e90810b8df3e80c413d903f631643c716887138d"); cl_git_pass(git_repository_set_head_detached(repo, &id, sig, msg)); assert_head_reflog(repo, 0, "a65fedf39aefe402d3bb6e24df4d4f5fe4547750", "e90810b8df3e80c413d903f631643c716887138d", msg); /* Switching to an orphan branch does not write tot he reflog */ cl_git_pass(git_repository_set_head(repo, "refs/heads/orphan", sig, "ignored message")); assert_head_reflog(repo, 0, "a65fedf39aefe402d3bb6e24df4d4f5fe4547750", "e90810b8df3e80c413d903f631643c716887138d", msg); /* And coming back, we set the source to zero */ msg = "message2"; cl_git_pass(git_repository_set_head(repo, "refs/heads/haacked", sig, msg)); assert_head_reflog(repo, 0, "0000000000000000000000000000000000000000", "258f0e2a959a364e40ed6603d5d44fbb24765b10", msg); git_signature_free(sig); }
static void action_create_tag(tag_state *state) { git_repository *repo = state->repo; tag_options *opts = state->opts; git_signature *tagger; git_oid oid; git_object *target; check(!opts->tag_name, "Name required"); check(!opts->message, "Message required"); if (!opts->target) opts->target = "HEAD"; check_lg2(git_revparse_single(&target, repo, opts->target), "Unable to resolve spec", opts->target); check_lg2(git_signature_default(&tagger, repo), "Unable to create signature", NULL); check_lg2(git_tag_create(&oid, repo, opts->tag_name, target, tagger, opts->message, opts->force), "Unable to create tag", NULL); git_object_free(target); git_signature_free(tagger); }
int git_signature_new(git_signature **sig_out, const char *name, const char *email, git_time_t time, int offset) { int error; git_signature *p = NULL; assert(name && email); *sig_out = NULL; p = git__calloc(1, sizeof(git_signature)); GITERR_CHECK_ALLOC(p); if ((error = process_trimming(name, &p->name, name + strlen(name), 1)) < 0 || (error = process_trimming(email, &p->email, email + strlen(email), 1)) < 0) { git_signature_free(p); return error; } p->when.time = time; p->when.offset = offset; *sig_out = p; return 0; }
void test_repo_head__set_to_current_target(void) { git_signature *sig; const char *msg; git_reflog *log; size_t nentries, nentries_after; cl_git_pass(git_reflog_read(&log, repo, GIT_HEAD_FILE)); nentries = git_reflog_entrycount(log); git_reflog_free(log); cl_git_pass(git_signature_now(&sig, "me", "*****@*****.**")); msg = "message 1"; cl_git_pass(git_repository_set_head(repo, "refs/heads/haacked", sig, msg)); cl_git_pass(git_repository_set_head(repo, "refs/heads/haacked", sig, msg)); cl_git_pass(git_reflog_read(&log, repo, GIT_HEAD_FILE)); nentries_after = git_reflog_entrycount(log); git_reflog_free(log); cl_assert_equal_i(nentries + 1, nentries_after); git_signature_free(sig); }
void test_rebase_abort__detached_head(void) { git_rebase *rebase; git_oid branch_id; git_reference *onto_ref; git_signature *signature; git_annotated_commit *branch_head, *onto_head; git_oid_fromstr(&branch_id, "b146bd7608eac53d9bf9e1a6963543588b555c64"); cl_git_pass(git_reference_lookup(&onto_ref, repo, "refs/heads/master")); cl_git_pass(git_annotated_commit_lookup(&branch_head, repo, &branch_id)); cl_git_pass(git_annotated_commit_from_ref(&onto_head, repo, onto_ref)); cl_git_pass(git_signature_new(&signature, "Rebaser", "*****@*****.**", 1404157834, -400)); cl_git_pass(git_rebase_init(&rebase, repo, branch_head, NULL, onto_head, signature, NULL)); cl_assert_equal_i(GIT_REPOSITORY_STATE_REBASE_MERGE, git_repository_state(repo)); test_abort(branch_head, onto_head); git_signature_free(signature); git_annotated_commit_free(branch_head); git_annotated_commit_free(onto_head); git_reference_free(onto_ref); git_rebase_free(rebase); }
void MainWindow::on_pushButtonTag_clicked() { //make a tag! if (repo == NULL) return; qDebug() << "making a tag..."; git_oid oid; git_object *target = NULL; git_signature *tagger = NULL; int err = git_revparse_single(&target, repo, "HEAD^{commit}"); qDebug() << "reverseparse: "<<err; err = git_signature_now(&tagger, "johnty", "*****@*****.**"); qDebug() << "get signature: "<<err; //probably not the best text widgets to use? const char* tag_name = ui->textTagName->toPlainText().toStdString().c_str(); const char* tag_msg = ui->textTagAnno->toPlainText().toStdString().c_str(); err = git_tag_create( &oid, /* new object id */ repo, /* repo */ tag_name, /* name */ target, /* target */ tagger, /* name/email/timestamp */ tag_msg, /* message */ false); /* force? */ qDebug() << "create tag: "<<err; git_object_free(target); git_signature_free(tagger); }
void test_notes_notes__cleanup(void) { git_signature_free(_sig); _sig = NULL; cl_git_sandbox_cleanup(); }
int git_signature_new(git_signature **sig_out, const char *name, const char *email, git_time_t time, int offset) { git_signature *p = NULL; assert(name && email); *sig_out = NULL; if (contains_angle_brackets(name) || contains_angle_brackets(email)) { return signature_error( "Neither `name` nor `email` should contain angle brackets chars."); } p = git__calloc(1, sizeof(git_signature)); GITERR_CHECK_ALLOC(p); p->name = extract_trimmed(name, strlen(name)); GITERR_CHECK_ALLOC(p->name); p->email = extract_trimmed(email, strlen(email)); GITERR_CHECK_ALLOC(p->email); if (p->name[0] == '\0' || p->email[0] == '\0') { git_signature_free(p); return signature_error("Signature cannot have an empty name or email"); } p->when.time = time; p->when.offset = offset; *sig_out = p; return 0; }
void GitRepository::setSignature(const QString& authorName, const QString& authorEmail) { git_signature* sig = m_signature; if (sig) { git_signature_free(sig); } git_eval(git_signature_now(&sig, authorName.toLocal8Bit(), authorEmail.toLocal8Bit())); m_signature = sig; }
void git_reflog_entry__free(git_reflog_entry *entry) { git_signature_free(entry->committer); git__free(entry->msg); git__free(entry); }
static int copy_common(transaction_node *node, git_transaction *tx, const git_signature *sig, const char *msg) { if (sig && git_signature__pdup(&node->sig, sig, &tx->pool) < 0) return -1; if (!node->sig) { git_signature *tmp; int error; if (git_reference__log_signature(&tmp, tx->repo) < 0) return -1; /* make sure the sig we use is in our pool */ error = git_signature__pdup(&node->sig, tmp, &tx->pool); git_signature_free(tmp); if (error < 0) return error; } if (msg) { node->message = git_pool_strdup(&tx->pool, msg); GITERR_CHECK_ALLOC(node->message); } return 0; }
void git_tag__free(git_tag *tag) { git_signature_free(tag->tagger); git__free(tag->message); git__free(tag->tag_name); git__free(tag); }
static void stage_and_commit(git_repository *repo, const char *path) { git_oid tree_oid, commit_oid; git_tree *tree; git_signature *signature; git_index *index; cl_git_pass(git_repository_index(&index, repo)); cl_git_pass(git_index_add_bypath(index, path)); cl_git_pass(git_index_write(index)); cl_git_pass(git_index_write_tree(&tree_oid, index)); git_index_free(index); cl_git_pass(git_tree_lookup(&tree, repo, &tree_oid)); cl_git_pass(git_signature_new(&signature, "nulltoken", "*****@*****.**", 1323847743, 60)); cl_git_pass(git_commit_create_v( &commit_oid, repo, "HEAD", signature, signature, NULL, "Initial commit\n\0", tree, 0)); git_tree_free(tree); git_signature_free(signature); }
void test_rebase_abort__merge(void) { git_rebase *rebase; git_reference *branch_ref, *onto_ref; git_signature *signature; git_annotated_commit *branch_head, *onto_head; cl_git_pass(git_reference_lookup(&branch_ref, repo, "refs/heads/beef")); cl_git_pass(git_reference_lookup(&onto_ref, repo, "refs/heads/master")); cl_git_pass(git_annotated_commit_from_ref(&branch_head, repo, branch_ref)); cl_git_pass(git_annotated_commit_from_ref(&onto_head, repo, onto_ref)); cl_git_pass(git_signature_new(&signature, "Rebaser", "*****@*****.**", 1404157834, -400)); cl_git_pass(git_rebase_init(&rebase, repo, branch_head, NULL, onto_head, signature, NULL)); cl_assert_equal_i(GIT_REPOSITORY_STATE_REBASE_MERGE, git_repository_state(repo)); test_abort(branch_head, onto_head); git_signature_free(signature); git_annotated_commit_free(branch_head); git_annotated_commit_free(onto_head); git_reference_free(branch_ref); git_reference_free(onto_ref); git_rebase_free(rebase); }