summaryrefslogtreecommitdiff
path: root/tests-clar/notes/notesref.c
diff options
context:
space:
mode:
authorMichael Schubert <schu@schu.io>2012-04-30 14:29:34 +0200
committerMichael Schubert <schu@schu.io>2012-05-03 22:31:29 +0200
commit630c5a4a54bca28687f1c42117f830720f822fa6 (patch)
treede9a9677d332b9cb9da8a5eb35ecd0d7a658adbb /tests-clar/notes/notesref.c
parentcaea5e543379c053de5eec45b8f5a0e83c07e3fe (diff)
downloadlibgit2-630c5a4a54bca28687f1c42117f830720f822fa6.tar.gz
notes: add git_note_default_ref()
Add git_note_default_ref to allow easy retrieval of the currently set default notes reference.
Diffstat (limited to 'tests-clar/notes/notesref.c')
-rw-r--r--tests-clar/notes/notesref.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests-clar/notes/notesref.c b/tests-clar/notes/notesref.c
index f1456663a..79ad0afee 100644
--- a/tests-clar/notes/notesref.c
+++ b/tests-clar/notes/notesref.c
@@ -1,5 +1,7 @@
#include "clar_libgit2.h"
+#include "notes.h"
+
static git_repository *_repo;
static git_note *_note;
static git_signature *_sig;
@@ -24,6 +26,7 @@ void test_notes_notesref__cleanup(void)
void test_notes_notesref__config_corenotesref(void)
{
git_oid oid, note_oid;
+ const char *default_ref;
cl_git_pass(git_signature_now(&_sig, "alice", "alice@example.com"));
cl_git_pass(git_oid_fromstr(&oid, "8496071c1b46c854b31185ea97743be6a8774479"));
@@ -43,4 +46,12 @@ void test_notes_notesref__config_corenotesref(void)
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), &note_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));
}