Commit 5c7b77c4f8707571530fc2b2c3b7154965a27344

Scott J. Goldman 2013-01-22T16:01:03

Seperate out a new test that verifies packed-refs with no trailing newline as per @vmg's request

diff --git a/tests-clar/object/tag/read.c b/tests-clar/object/tag/read.c
index 6dab2a9..16e3e63 100644
--- a/tests-clar/object/tag/read.c
+++ b/tests-clar/object/tag/read.c
@@ -62,7 +62,6 @@ void test_object_tag_read__parse_without_tagger(void)
    git_tag *bad_tag;
    git_commit *commit;
    git_oid id, id_commit;
-   git_strarray ref_list;
 
    // TODO: This is a little messy
    cl_git_pass(git_repository_open(&bad_tag_repo, cl_fixture("bad_tag.git")));
@@ -82,9 +81,7 @@ void test_object_tag_read__parse_without_tagger(void)
 
    cl_assert(git_oid_cmp(&id_commit, git_commit_id(commit)) == 0);
 
-   cl_git_pass(git_reference_list(&ref_list, bad_tag_repo, GIT_REF_LISTALL));
 
-   git_strarray_free(&ref_list);
    git_tag_free(bad_tag);
    git_commit_free(commit);
    git_repository_free(bad_tag_repo);
diff --git a/tests-clar/refs/listall.c b/tests-clar/refs/listall.c
index 7f1de74..8f4c374 100644
--- a/tests-clar/refs/listall.c
+++ b/tests-clar/refs/listall.c
@@ -34,3 +34,14 @@ void test_refs_listall__from_repository_opened_through_gitdir_path(void)
 {
 	ensure_no_refname_starts_with_a_forward_slash(cl_fixture("testrepo.git"));
 }
+
+void test_refs_listall__from_repository_with_no_trailing_newline(void)
+{
+	cl_git_pass(git_repository_open(&repo, cl_fixture("bad_tag.git")));
+	cl_git_pass(git_reference_list(&ref_list, repo, GIT_REF_LISTALL));
+
+	cl_assert(ref_list.count > 0);
+
+	git_strarray_free(&ref_list);
+	git_repository_free(repo);
+}