summaryrefslogtreecommitdiff
path: root/tests-clar
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@dwim.me>2013-08-17 07:11:31 +0200
committerCarlos Martín Nieto <cmn@dwim.me>2013-10-11 16:29:59 +0200
commit7c9f5bec5182eb587fbc1094f2235d2babb70ad9 (patch)
tree59a8a653c0ae1943deb133c42a2fc730bc995bd6 /tests-clar
parent51a5e13347a0f834e2d847b46d2f6002f03bd49f (diff)
downloadlibgit2-7c9f5bec5182eb587fbc1094f2235d2babb70ad9.tar.gz
futils: return GIT_ENOTFOUND when trying to read a directory
This lets the reference code return not-found when the user asks to look up a reference when in fact they pass a namespace.
Diffstat (limited to 'tests-clar')
-rw-r--r--tests-clar/refs/lookup.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests-clar/refs/lookup.c b/tests-clar/refs/lookup.c
index 0dbebc5c2..2e31cf0f6 100644
--- a/tests-clar/refs/lookup.c
+++ b/tests-clar/refs/lookup.c
@@ -46,3 +46,15 @@ void test_refs_lookup__oid(void)
cl_git_pass(git_oid_fromstr(&expected, "1385f264afb75a56a5bec74243be9b367ba4ca08"));
cl_assert(git_oid_cmp(&tag, &expected) == 0);
}
+
+void test_refs_lookup__namespace(void)
+{
+ int error;
+ git_reference *ref;
+
+ error = git_reference_lookup(&ref, g_repo, "refs/heads");
+ cl_assert_equal_i(error, GIT_ENOTFOUND);
+
+ error = git_reference_lookup(&ref, g_repo, "refs/heads/");
+ cl_assert_equal_i(error, GIT_EINVALIDSPEC);
+}