| 823 | } |
| 824 | |
| 825 | static struct ref_iterator *reftable_be_iterator_begin(struct ref_store *ref_store, |
| 826 | const char *prefix, |
| 827 | const char **exclude_patterns, |
| 828 | unsigned int flags) |
| 829 | { |
| 830 | struct reftable_ref_iterator *main_iter, *worktree_iter; |
| 831 | struct reftable_ref_store *refs; |
| 832 | unsigned int required_flags = REF_STORE_READ; |
| 833 | |
| 834 | if (!(flags & REFS_FOR_EACH_INCLUDE_BROKEN)) |
| 835 | required_flags |= REF_STORE_ODB; |
| 836 | refs = reftable_be_downcast(ref_store, required_flags, "ref_iterator_begin"); |
| 837 | |
| 838 | main_iter = ref_iterator_for_stack(refs, refs->main_backend.stack, prefix, |
| 839 | exclude_patterns, flags); |
| 840 | |
| 841 | /* |
| 842 | * The worktree stack is only set when we're in an actual worktree |
| 843 | * right now. If we aren't, then we return the common reftable |
| 844 | * iterator, only. |
| 845 | */ |
| 846 | if (!refs->worktree_backend.stack) |
| 847 | return &main_iter->base; |
| 848 | |
| 849 | /* |
| 850 | * Otherwise we merge both the common and the per-worktree refs into a |
| 851 | * single iterator. |
| 852 | */ |
| 853 | worktree_iter = ref_iterator_for_stack(refs, refs->worktree_backend.stack, prefix, |
| 854 | exclude_patterns, flags); |
| 855 | return merge_ref_iterator_begin(&worktree_iter->base, &main_iter->base, |
| 856 | ref_iterator_select, NULL); |
| 857 | } |
| 858 | |
| 859 | static int reftable_be_read_raw_ref(struct ref_store *ref_store, |
| 860 | const char *refname, |
nothing calls this directly
no test coverage detected