void test_notes_notesref__config_corenotesref(void) { git_oid oid, note_oid; const char *default_ref; cl_git_pass(git_signature_now(&_sig, "alice", "*****@*****.**")); cl_git_pass(git_oid_fromstr(&oid, "8496071c1b46c854b31185ea97743be6a8774479")); cl_git_pass(git_repository_config(&_cfg, _repo)); cl_git_pass(git_config_set_string(_cfg, "core.notesRef", "refs/notes/mydefaultnotesref")); cl_git_pass(git_note_create(¬e_oid, _repo, _sig, _sig, NULL, &oid, "test123test\n")); cl_git_pass(git_note_read(&_note, _repo, NULL, &oid)); cl_assert(!strcmp(git_note_message(_note), "test123test\n")); cl_assert(!git_oid_cmp(git_note_oid(_note), ¬e_oid)); git_note_free(_note); cl_git_pass(git_note_read(&_note, _repo, "refs/notes/mydefaultnotesref", &oid)); cl_assert(!strcmp(git_note_message(_note), "test123test\n")); cl_assert(!git_oid_cmp(git_note_oid(_note), ¬e_oid)); cl_git_pass(git_note_default_ref(&default_ref, _repo)); cl_assert(!strcmp(default_ref, "refs/notes/mydefaultnotesref")); cl_git_pass(git_config_delete(_cfg, "core.notesRef")); cl_git_pass(git_note_default_ref(&default_ref, _repo)); cl_assert(!strcmp(default_ref, GIT_NOTES_DEFAULT_REF)); }
static VALUE rugged_git_note_oid(const git_note* note) { const git_oid *oid; oid = git_note_oid(note); return rugged_create_oid(oid); }
void test_notes_notes__1(void) { git_oid oid, note_oid; static git_note *note; static git_blob *blob; cl_git_pass(git_oid_fromstr(&oid, "8496071c1b46c854b31185ea97743be6a8774479")); cl_git_pass(git_note_create(¬e_oid, _repo, _sig, _sig, "refs/notes/some/namespace", &oid, "hello world\n")); cl_git_pass(git_note_create(¬e_oid, _repo, _sig, _sig, NULL, &oid, "hello world\n")); cl_git_pass(git_note_read(¬e, _repo, NULL, &oid)); cl_assert_equal_s(git_note_message(note), "hello world\n"); cl_assert(!git_oid_cmp(git_note_oid(note), ¬e_oid)); cl_git_pass(git_blob_lookup(&blob, _repo, ¬e_oid)); cl_assert_equal_s(git_note_message(note), git_blob_rawcontent(blob)); cl_git_fail(git_note_create(¬e_oid, _repo, _sig, _sig, NULL, &oid, "hello world\n")); cl_git_fail(git_note_create(¬e_oid, _repo, _sig, _sig, "refs/notes/some/namespace", &oid, "hello world\n")); cl_git_pass(git_note_remove(_repo, NULL, _sig, _sig, &oid)); cl_git_pass(git_note_remove(_repo, "refs/notes/some/namespace", _sig, _sig, &oid)); cl_git_fail(git_note_remove(_repo, NULL, _sig, _sig, ¬e_oid)); cl_git_fail(git_note_remove(_repo, "refs/notes/some/namespace", _sig, _sig, &oid)); git_note_free(note); git_blob_free(blob); }
static void assert_note_equal(git_note *note, char *message, git_oid *note_oid) { git_blob *blob; cl_assert_equal_s(git_note_message(note), message); cl_assert(!git_oid_cmp(git_note_oid(note), note_oid)); cl_git_pass(git_blob_lookup(&blob, _repo, note_oid)); cl_assert_equal_s(git_note_message(note), (const char *)git_blob_rawcontent(blob)); git_blob_free(blob); }
/* * $ git notes --ref fanout list 8496071c1b46c854b31185ea97743be6a8774479 * 08b041783f40edfe12bb406c9c9a8a040177c125 */ void test_notes_notes__can_read_a_note_in_an_existing_fanout(void) { git_oid note_oid, target_oid; git_note *note; cl_git_pass(git_oid_fromstr(&target_oid, "8496071c1b46c854b31185ea97743be6a8774479")); cl_git_pass(git_note_read(¬e, _repo, "refs/notes/fanout", &target_oid)); cl_git_pass(git_oid_fromstr(¬e_oid, "08b041783f40edfe12bb406c9c9a8a040177c125")); cl_assert(!git_oid_cmp(git_note_oid(note), ¬e_oid)); git_note_free(note); }
PyObject * Note_oid__get__(Note *self) { return git_oid_to_python(git_note_oid(self->note)); }