cache_ref_iterator_begin(): make function smarter
commit059ae35a4871428f49500a22fd0b3eb6e1b424c3
authorMichael Haggerty <mhagger@alum.mit.edu>
Sun, 16 Apr 2017 06:41:39 +0000 (16 08:41 +0200)
committerJunio C Hamano <gitster@pobox.com>
Mon, 17 Apr 2017 04:32:46 +0000 (16 21:32 -0700)
tree4adad905d2ba47efd2a9274a9219ad21dec21c9c
parenta714b19ca81607e53ddbde41eb9082b435148e73
cache_ref_iterator_begin(): make function smarter

Change `cache_ref_iterator_begin()` to take two new arguments:

* `prefix` -- to iterate only over references with the specified
  prefix.

* `prime_dir` -- to "prime" (i.e., pre-load) the cache before starting
  the iteration.

The new functionality makes it possible for
`files_ref_iterator_begin()` to be made more ignorant of the internals
of `ref_cache`, and `find_containing_dir()` and `prime_ref_dir()` to
be made private.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
refs/files-backend.c
refs/ref-cache.c
refs/ref-cache.h