aboutsummaryrefslogtreecommitdiffstats
path: root/refs/ref-cache.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2025-07-29 09:28:48 -0700
committerJunio C Hamano <gitster@pobox.com>2025-07-29 09:28:49 -0700
commit6e97c528ef7fc6d18df7ae281e63627ba4c2caea (patch)
tree7085af2bb050d5fc15673a1f2a460f043e92fb20 /refs/ref-cache.c
parentMerge branch 'jt/switch-restore-no-longer-experimental' into next (diff)
parentref-filter: use REF_ITERATOR_SEEK_SET_PREFIX instead of '1' (diff)
downloadgit-6e97c528ef7fc6d18df7ae281e63627ba4c2caea.tar.gz
git-6e97c528ef7fc6d18df7ae281e63627ba4c2caea.zip
Merge branch 'kn/for-each-ref-skip-updates' into next
Code clean-up. * kn/for-each-ref-skip-updates: ref-filter: use REF_ITERATOR_SEEK_SET_PREFIX instead of '1' t6302: add test combining '--start-after' with '--exclude' for-each-ref: reword the documentation for '--start-after' for-each-ref: fix documentation argument ordering ref-cache: use 'size_t' instead of int for length
Diffstat (limited to 'refs/ref-cache.c')
-rw-r--r--refs/ref-cache.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/refs/ref-cache.c b/refs/ref-cache.c
index ceef3a2008..c180e0aad7 100644
--- a/refs/ref-cache.c
+++ b/refs/ref-cache.c
@@ -498,13 +498,14 @@ static int cache_ref_iterator_seek(struct ref_iterator *ref_iterator,
* indexing to each level as needed.
*/
do {
- int len, idx;
+ int idx;
+ size_t len;
int cmp = 0;
sort_ref_dir(dir);
slash = strchr(slash, '/');
- len = slash ? slash - refname : (int)strlen(refname);
+ len = slash ? (size_t)(slash - refname) : strlen(refname);
for (idx = 0; idx < dir->nr; idx++) {
cmp = strncmp(refname, dir->entries[idx]->name, len);