Skip to content

Commit c759971

Browse files
mhaggergitster
authored andcommitted
refs_ref_iterator_begin(): don't check prefixes redundantly
The backend already correctly restricts its output to references whose names start with the prefix. By passing the prefix again to `prefix_ref_iterator`, we were forcing that iterator to do redundant prefix comparisons. So set it to the empty string. Signed-off-by: Michael Haggerty <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent b9c8e7f commit c759971

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

refs.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1247,7 +1247,13 @@ struct ref_iterator *refs_ref_iterator_begin(
12471247
struct ref_iterator *iter;
12481248

12491249
iter = refs->be->iterator_begin(refs, prefix, flags);
1250-
iter = prefix_ref_iterator_begin(iter, prefix, trim);
1250+
1251+
/*
1252+
* `iterator_begin()` already takes care of prefix, but we
1253+
* might need to do some trimming:
1254+
*/
1255+
if (trim)
1256+
iter = prefix_ref_iterator_begin(iter, "", trim);
12511257

12521258
return iter;
12531259
}

0 commit comments

Comments
 (0)