summaryrefslogtreecommitdiff
path: root/tests-clar
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@dwim.me>2012-10-15 13:51:25 +0200
committerCarlos Martín Nieto <cmn@dwim.me>2012-10-15 14:00:19 +0200
commit47f44b6ee424921cf5aef064fe6ecf768c6ec5ea (patch)
treebaf5cffab7b8dc1d85679a931b952809692ac818 /tests-clar
parent9d9288f417968a7fd583786a749c4f7dfa258f89 (diff)
downloadlibgit2-47f44b6ee424921cf5aef064fe6ecf768c6ec5ea.tar.gz
refs: loosen the OID parsing
We used to require loose references to contain only an OID (possibly after trimming the string). This is however not enough for letting us lookup FETCH_HEAD, which can have a lot of content after the initial OID. Change the parsing rules so that a loose refernce must e at least 40 bytes long and the 41st (if it's there) must be accepted by isspace(3). This makes the trim unnecessary, so only do it for symrefs. This fixes #977.
Diffstat (limited to 'tests-clar')
-rw-r--r--tests-clar/refs/read.c1
-rw-r--r--tests-clar/resources/testrepo.git/FETCH_HEAD2
2 files changed, 3 insertions, 0 deletions
diff --git a/tests-clar/refs/read.c b/tests-clar/refs/read.c
index 6ab6bf586..fc2d6b902 100644
--- a/tests-clar/refs/read.c
+++ b/tests-clar/refs/read.c
@@ -212,6 +212,7 @@ void test_refs_read__trailing(void)
cl_git_pass(git_reference_lookup(&test, g_repo, "refs/heads/test"));
cl_git_pass(git_reference_lookup(&trailing, g_repo, "refs/heads/trailing"));
cl_git_pass(git_oid_cmp(git_reference_oid(test), git_reference_oid(trailing)));
+ cl_git_pass(git_reference_lookup(&trailing, g_repo, "FETCH_HEAD"));
git_reference_free(test);
git_reference_free(trailing);
diff --git a/tests-clar/resources/testrepo.git/FETCH_HEAD b/tests-clar/resources/testrepo.git/FETCH_HEAD
new file mode 100644
index 000000000..48446265c
--- /dev/null
+++ b/tests-clar/resources/testrepo.git/FETCH_HEAD
@@ -0,0 +1,2 @@
+a65fedf39aefe402d3bb6e24df4d4f5fe4547750 branch 'master' of git://example.com/git/testrepo.git
+258f0e2a959a364e40ed6603d5d44fbb24765b10 not-for-merge branch 'haacked' of git://example.com/git/testrepo.git