Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/refs.c
diff options
context:
space:
mode:
authorMichael Haggerty <mhagger@alum.mit.edu>2017-05-22 17:17:36 +0300
committerJunio C Hamano <gitster@pobox.com>2017-05-23 08:29:53 +0300
commitc7599718167de62c437490e9ea300eeb9284a572 (patch)
tree8ce2f1351c2287cf6ee485d8beaf3142f0b29352 /refs.c
parentb9c8e7f2fb6ee19defeaa2927a0af42b525d8b33 (diff)
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 <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'refs.c')
-rw-r--r--refs.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/refs.c b/refs.c
index 8af9641aa17..8494b1f20d5 100644
--- a/refs.c
+++ b/refs.c
@@ -1247,7 +1247,13 @@ struct ref_iterator *refs_ref_iterator_begin(
struct ref_iterator *iter;
iter = refs->be->iterator_begin(refs, prefix, flags);
- iter = prefix_ref_iterator_begin(iter, prefix, trim);
+
+ /*
+ * `iterator_begin()` already takes care of prefix, but we
+ * might need to do some trimming:
+ */
+ if (trim)
+ iter = prefix_ref_iterator_begin(iter, "", trim);
return iter;
}