Thread (1 message) 1 message, 1 author, 2025-07-17

Re: [PATCH v3 3/4] refs: selectively set prefix in the seek functions

From: Junio C Hamano <hidden>
Date: 2025-07-17 17:31:47

Karthik Nayak [off-list ref] writes:
quoted
Yes, even though I wouldn't call such an operation "seek", "Ah, I do
not need the entire refs/heads/ walked, only refs/heads/feature/ is
enough" is an operation mode that makes sense.

But not for paging, though.
Actually, you are not using the new value for prefix; you are
unsetting prefix to nothing, so you do not stop when you go over the
boundary of refs/heads/feature/ hierarchy but will run through to
the end, so my worry is unfounded.

Which is good.

But the application has to decide when to stop as "We obtained an
iterator in order to list all branches in refs/heads/ and the last
round we gave refs/heads/main out.  Seek to it and continue the
output" will no longer stop after making a callback with
refs/heads/zz but will continue yielding non branch refs after that.
The current implementation doesn't
support '--start-after' and prefix setting at the same time:

$ git for-each-ref --format="%(refname)"
--start-after=refs/heads/master refs/heads
fatal: cannot use --start-after with patterns
Good---in that case, "unsetting prefix to nothing" does not make any
difference and cannot introduce any confusing behaviour, as it has to
run to the end with or without "--start-after" anyway.

Thanks.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help