Re: [PATCH v4 0/4] for-each-ref: introduce seeking functionality via '--start-after'
From: Christian Couder <hidden>
Date: 2025-07-14 16:35:12
On Fri, Jul 11, 2025 at 6:20 PM Karthik Nayak [off-list ref] wrote:
Initially I was also planning to cleanup all the `refs_for_each...()` functions in 'refs.h' by simply using the iterator, but this bloated the series. So I've left that for another day.
I wonder if there is a plan to add the '--start-after' option to `git branch` and `git tag` too?
Karthik Nayak (4):
refs: expose `ref_iterator` via 'refs.h'
ref-cache: remove unused function 'find_ref_entry()'
refs: selectively set prefix in the seek functions
for-each-ref: introduce a '--start-after' optionExcept for the few small comments I left on the two last patches and one below, this looks good to me. [ ... ]
Range-diff versus v3:
[ ... ]
+ struct cache_ref_iterator *iter =
+ (struct cache_ref_iterator *)ref_iterator;
+
+ if (flags & REF_ITERATOR_SEEK_SET_PREFIX) {
-+ return cache_ref_iterator_set_prefix(iter, seek);
-+ } else if (seek && *seek) {
++ return cache_ref_iterator_set_prefix(iter, refname);
++ } else if (refname && *refname) {Nit: the `else` here could be removed, but yeah it might be better to do that in a preparatory patch.
+ struct cache_ref_iterator_level *level;
-+ const char *slash = seek;
++ const char *slash = refname;
+ struct ref_dir *dir;