diff options
author | Russell Belfer <rb@github.com> | 2013-08-19 21:42:48 +0400 |
---|---|---|
committer | Russell Belfer <rb@github.com> | 2013-08-21 03:14:23 +0400 |
commit | 0f0f565507565520759bffc22976c583497ec01f (patch) | |
tree | 5b3bf0956720df4dc1694dcad9d8b2b6ed28f98a /tests-clar/refs | |
parent | 5e1fb2828a496d70c5c200b01e2fb0062268f468 (diff) |
Don't try to pack symbolic refs
If there were symbolic refs among the loose refs then the code
to create packed-refs would fail trying to parse the OID out of
them (where Git just skips trying to pack them). This fixes it.
Diffstat (limited to 'tests-clar/refs')
-rw-r--r-- | tests-clar/refs/pack.c | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/tests-clar/refs/pack.c b/tests-clar/refs/pack.c index d8d5cc6d0..6019ed75a 100644 --- a/tests-clar/refs/pack.c +++ b/tests-clar/refs/pack.c @@ -32,7 +32,7 @@ static void packall(void) void test_refs_pack__empty(void) { - // create a packfile for an empty folder + /* create a packfile for an empty folder */ git_buf temp_path = GIT_BUF_INIT; cl_git_pass(git_buf_join_n(&temp_path, '/', 3, git_repository_path(g_repo), GIT_REFS_HEADS_DIR, "empty_dir")); @@ -44,7 +44,7 @@ void test_refs_pack__empty(void) void test_refs_pack__loose(void) { - // create a packfile from all the loose rn a repo + /* create a packfile from all the loose rn a repo */ git_reference *reference; git_buf temp_path = GIT_BUF_INIT; @@ -77,3 +77,29 @@ void test_refs_pack__loose(void) git_reference_free(reference); git_buf_free(&temp_path); } + +void test_refs_pack__symbolic(void) +{ + /* create a packfile from loose refs skipping symbolic refs */ + int i; + git_oid head; + git_reference *ref; + char name[128]; + + cl_git_pass(git_reference_name_to_id(&head, g_repo, "HEAD")); + + /* make a bunch of references */ + + for (i = 0; i < 100; ++i) { + snprintf(name, sizeof(name), "refs/heads/symbolic-%03d", i); + cl_git_pass(git_reference_symbolic_create( + &ref, g_repo, name, "refs/heads/master", 0)); + git_reference_free(ref); + + snprintf(name, sizeof(name), "refs/heads/direct-%03d", i); + cl_git_pass(git_reference_create(&ref, g_repo, name, &head, 0)); + git_reference_free(ref); + } + + packall(); +} |