Commit e60af90498c5be3fc132901009f7d8fc8bb0087f

Joshua Peek 2012-08-09T14:39:43

Test trailing space after ref oid

diff --git a/tests-clar/network/remotelocal.c b/tests-clar/network/remotelocal.c
index 9c8ce35..63016db 100644
--- a/tests-clar/network/remotelocal.c
+++ b/tests-clar/network/remotelocal.c
@@ -107,7 +107,7 @@ void test_network_remotelocal__retrieve_advertised_references(void)
 
 	cl_git_pass(git_remote_ls(remote, &count_ref__cb, &how_many_refs));
 
-	cl_assert_equal_i(how_many_refs, 24);
+	cl_assert_equal_i(how_many_refs, 25);
 }
 
 void test_network_remotelocal__retrieve_advertised_references_from_spaced_repository(void)
@@ -121,7 +121,7 @@ void test_network_remotelocal__retrieve_advertised_references_from_spaced_reposi
 
 	cl_git_pass(git_remote_ls(remote, &count_ref__cb, &how_many_refs));
 
-	cl_assert_equal_i(how_many_refs, 24);
+	cl_assert_equal_i(how_many_refs, 25);
 
 	git_remote_free(remote);	/* Disconnect from the "spaced repo" before the cleanup */
 	remote = NULL;
diff --git a/tests-clar/refs/branches/foreach.c b/tests-clar/refs/branches/foreach.c
index ca1393b..aca11ec 100644
--- a/tests-clar/refs/branches/foreach.c
+++ b/tests-clar/refs/branches/foreach.c
@@ -47,7 +47,7 @@ static void assert_retrieval(unsigned int flags, unsigned int expected_count)
 
 void test_refs_branches_foreach__retrieve_all_branches(void)
 {
-	assert_retrieval(GIT_BRANCH_LOCAL | GIT_BRANCH_REMOTE, 12);
+	assert_retrieval(GIT_BRANCH_LOCAL | GIT_BRANCH_REMOTE, 13);
 }
 
 void test_refs_branches_foreach__retrieve_remote_branches(void)
@@ -57,7 +57,7 @@ void test_refs_branches_foreach__retrieve_remote_branches(void)
 
 void test_refs_branches_foreach__retrieve_local_branches(void)
 {
-	assert_retrieval(GIT_BRANCH_LOCAL, 10);
+	assert_retrieval(GIT_BRANCH_LOCAL, 11);
 }
 
 struct expectations {
diff --git a/tests-clar/refs/foreachglob.c b/tests-clar/refs/foreachglob.c
index ba58c20..054846f 100644
--- a/tests-clar/refs/foreachglob.c
+++ b/tests-clar/refs/foreachglob.c
@@ -46,7 +46,7 @@ static void assert_retrieval(const char *glob, unsigned int flags, int expected_
 void test_refs_foreachglob__retrieve_all_refs(void)
 {
 	/* 8 heads (including one packed head) + 1 note + 2 remotes + 6 tags */
-	assert_retrieval("*", GIT_REF_LISTALL, 19);
+	assert_retrieval("*", GIT_REF_LISTALL, 20);
 }
 
 void test_refs_foreachglob__retrieve_remote_branches(void)
@@ -56,7 +56,7 @@ void test_refs_foreachglob__retrieve_remote_branches(void)
 
 void test_refs_foreachglob__retrieve_local_branches(void)
 {
-	assert_retrieval("refs/heads/*", GIT_REF_LISTALL, 10);
+	assert_retrieval("refs/heads/*", GIT_REF_LISTALL, 11);
 }
 
 void test_refs_foreachglob__retrieve_partially_named_references(void)
diff --git a/tests-clar/refs/read.c b/tests-clar/refs/read.c
index 395225b..f336587 100644
--- a/tests-clar/refs/read.c
+++ b/tests-clar/refs/read.c
@@ -205,6 +205,18 @@ void test_refs_read__chomped(void)
 	git_reference_free(chomped);
 }
 
+void test_refs_read__trailing(void)
+{
+	git_reference *test, *trailing;
+
+	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)));
+
+	git_reference_free(test);
+	git_reference_free(trailing);
+}
+
 void test_refs_read__unfound_return_ENOTFOUND(void)
 {
 	git_reference *reference;
diff --git a/tests-clar/resources/testrepo.git/refs/heads/trailing b/tests-clar/resources/testrepo.git/refs/heads/trailing
new file mode 100644
index 0000000..2a4a6e6
--- /dev/null
+++ b/tests-clar/resources/testrepo.git/refs/heads/trailing
@@ -0,0 +1 @@
+e90810b8df3e80c413d903f631643c716887138d