path: root/refs/ref-cache.h
diff options
authorMichael Haggerty <>2017-09-13 17:15:55 (GMT)
committerJunio C Hamano <>2017-09-14 06:19:07 (GMT)
commit8738a8a4df9ee50112b5f5a757c58988166974d3 (patch)
tree2c7b060f1d6f7a7f0c6684c1e59e1adff9395433 /refs/ref-cache.h
parent5e00a6c873981f87165adfecf29ad0ecc2c2c5df (diff)
ref_iterator: keep track of whether the iterator output is ordered
References are iterated over in order by refname, but reflogs are not. Some consumers of reference iteration care about the difference. Teach each `ref_iterator` to keep track of whether its output is ordered. `overlay_ref_iterator` is one of the picky consumers. Add a sanity check in `overlay_ref_iterator_begin()` to verify that its inputs are ordered. Signed-off-by: Michael Haggerty <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'refs/ref-cache.h')
1 files changed, 2 insertions, 1 deletions
diff --git a/refs/ref-cache.h b/refs/ref-cache.h
index 794f000..a082bfb 100644
--- a/refs/ref-cache.h
+++ b/refs/ref-cache.h
@@ -245,7 +245,8 @@ struct ref_entry *find_ref_entry(struct ref_dir *dir, const char *refname);
* Start iterating over references in `cache`. If `prefix` is
* specified, only include references whose names start with that
* prefix. If `prime_dir` is true, then fill any incomplete
- * directories before beginning the iteration.
+ * directories before beginning the iteration. The output is ordered
+ * by refname.
struct ref_iterator *cache_ref_iterator_begin(struct ref_cache *cache,
const char *prefix,