]> git.ipfire.org Git - thirdparty/git.git/commit
ref-filter: use REF_ITERATOR_SEEK_SET_PREFIX instead of '1'
authorKarthik Nayak <karthik.188@gmail.com>
Mon, 28 Jul 2025 20:20:50 +0000 (22:20 +0200)
committerJunio C Hamano <gitster@pobox.com>
Mon, 28 Jul 2025 21:16:38 +0000 (14:16 -0700)
commit444ad14e02edc59e61f7d53ae3b9f8ebe90860fd
tree8b39c1542e1c617b7888522c7c9ec9308434b48b
parented9cc2144c97b3ad609d71b6033a95079179fc0e
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 <gitster@pobox.com>
Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
ref-filter.c