Skip to content

Commit 444ad14

Browse files
KarthikNayakgitster
authored andcommitted
ref-filter: use REF_ITERATOR_SEEK_SET_PREFIX instead of '1'
In the commit 51511d68f4 (for-each-ref: introduce a '--start-after' option, 2025-07-15), for introducing the '--start-after' flag, the `ref_iterator_seek()` was modified to also accept a flag. This was to allow the function to also set the prefix when 'REF_ITERATOR_SEEK_SET_PREFIX' was set. In `do_filter_refs()` instead of passing the flag, we pass in '1' which is the value of the flag. While this works, this is definitely hard to read and introduces inconsistency. Change it to use the flag. While here, remove the unnecessary 'if (prefix)' clause in the 'else' statement, since the block already checks for 'prefix'. Reported-by: Junio C Hamano <[email protected]> Signed-off-by: Karthik Nayak <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent ed9cc21 commit 444ad14

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

ref-filter.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3254,8 +3254,9 @@ static int do_filter_refs(struct ref_filter *filter, unsigned int type, each_ref
32543254

32553255
if (filter->start_after)
32563256
ret = start_ref_iterator_after(iter, filter->start_after);
3257-
else if (prefix)
3258-
ret = ref_iterator_seek(iter, prefix, 1);
3257+
else
3258+
ret = ref_iterator_seek(iter, prefix,
3259+
REF_ITERATOR_SEEK_SET_PREFIX);
32593260

32603261
if (!ret)
32613262
ret = do_for_each_ref_iterator(iter, fn, cb_data);

0 commit comments

Comments
 (0)