diff options
| author | Patrick Steinhardt <ps@pks.im> | 2020-06-17 15:09:49 +0200 |
|---|---|---|
| committer | Patrick Steinhardt <ps@pks.im> | 2020-07-12 18:12:16 +0200 |
| commit | d1f210fc323b501b9f9a3a8872b05ce76525a4e1 (patch) | |
| tree | 740635f665d15d00646bc7624670739379816e37 /tests/worktree/worktree.c | |
| parent | ac5fbe31edac2f126b21df69672b76077ee66933 (diff) | |
| download | libgit2-d1f210fc323b501b9f9a3a8872b05ce76525a4e1.tar.gz | |
repository: remove function to iterate over HEADs
The function `git_repository_foreach_head` is broken, as it directly
interacts with the on-disk representation of the reference database,
thus assuming that no other refdb is used for the given repository. As
this is an internal function only and all users have been replaced,
let's remove this function.
Diffstat (limited to 'tests/worktree/worktree.c')
| -rw-r--r-- | tests/worktree/worktree.c | 43 |
1 files changed, 0 insertions, 43 deletions
diff --git a/tests/worktree/worktree.c b/tests/worktree/worktree.c index a08c305bc..cd20bed82 100644 --- a/tests/worktree/worktree.c +++ b/tests/worktree/worktree.c @@ -581,49 +581,6 @@ void test_worktree_worktree__prune_worktree(void) git_worktree_free(wt); } -static int read_head_ref(git_repository *repo, const char *path, void *payload) -{ - git_vector *refs = (git_vector *) payload; - git_reference *head; - - GIT_UNUSED(repo); - - cl_git_pass(git_reference__read_head(&head, repo, path)); - - git_vector_insert(refs, head); - - return 0; -} - -void test_worktree_worktree__foreach_head_gives_same_results_in_wt_and_repo(void) -{ - git_vector repo_refs = GIT_VECTOR_INIT, worktree_refs = GIT_VECTOR_INIT; - git_reference *heads[2]; - size_t i; - - cl_git_pass(git_reference_lookup(&heads[0], fixture.repo, GIT_HEAD_FILE)); - cl_git_pass(git_reference_lookup(&heads[1], fixture.worktree, GIT_HEAD_FILE)); - - cl_git_pass(git_repository_foreach_head(fixture.repo, read_head_ref, 0, &repo_refs)); - cl_git_pass(git_repository_foreach_head(fixture.worktree, read_head_ref, 0, &worktree_refs)); - - cl_assert_equal_i(repo_refs.length, ARRAY_SIZE(heads)); - cl_assert_equal_i(worktree_refs.length, ARRAY_SIZE(heads)); - - for (i = 0; i < ARRAY_SIZE(heads); i++) { - cl_assert_equal_s(heads[i]->name, ((git_reference *) repo_refs.contents[i])->name); - cl_assert_equal_s(heads[i]->name, ((git_reference *) repo_refs.contents[i])->name); - cl_assert_equal_s(heads[i]->name, ((git_reference *) worktree_refs.contents[i])->name); - - git_reference_free(heads[i]); - git_reference_free(repo_refs.contents[i]); - git_reference_free(worktree_refs.contents[i]); - } - - git_vector_free(&repo_refs); - git_vector_free(&worktree_refs); -} - static int foreach_worktree_cb(git_repository *worktree, void *payload) { int *counter = (int *)payload; |
