summaryrefslogtreecommitdiff
path: root/commit-slab.h
diff options
context:
space:
mode:
authorKarthik Nayak <karthik.188@gmail.com>2025-07-15 13:28:30 +0200
committerJunio C Hamano <gitster@pobox.com>2025-07-15 11:54:20 -0700
commitdabecb9db2b25a32d72c90832f338849b665fdf9 (patch)
tree365fed331a67e6105cfd1f77776593773c0ce388 /commit-slab.h
parent526530a16a3c345643afb324107b4a216b8d37ff (diff)
for-each-ref: introduce a '--start-after' option
The `git-for-each-ref(1)` command is used to iterate over references present in a repository. In large repositories with millions of references, it would be optimal to paginate this output such that we can start iteration from a given reference. This would avoid having to iterate over all references from the beginning each time when paginating through results. The previous commit added 'seek' functionality to the reference backends. Utilize this and expose a '--start-after' option in 'git-for-each-ref(1)'. When used, the reference iteration seeks to the lexicographically next reference and iterates from there onward. This enables efficient pagination workflows, where the calling script can remember the last provided reference and use that as the starting point for the next set of references: git for-each-ref --count=100 git for-each-ref --count=100 --start-after=refs/heads/branch-100 git for-each-ref --count=100 --start-after=refs/heads/branch-200 Since the reference iterators only allow seeking to a specified marker via the `ref_iterator_seek()`, we introduce a helper function `start_ref_iterator_after()`, which seeks to next reference by simply adding (char) 1 to the marker. We must note that pagination always continues from the provided marker, as such any concurrent reference updates lexicographically behind the marker will not be output. Document the same. Signed-off-by: Karthik Nayak <karthik.188@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'commit-slab.h')
0 files changed, 0 insertions, 0 deletions