diff options
author | Jeff King <peff@peff.net> | 2017-05-22 16:17:54 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-05-23 14:29:56 +0900 |
commit | cfe004a5a9e5116d003332a64142b0f73f8f9cdf (patch) | |
tree | 9795cac35cac189c9f8de573fbcad3f699fcddcb /.gitattributes | |
parent | create_ref_entry(): remove `check_name` option (diff) | |
download | tgif-cfe004a5a9e5116d003332a64142b0f73f8f9cdf.tar.xz |
ref-filter: limit traversal to prefix
When we are matching refnames against a pattern, then we know that the
beginning of any refname that can match the pattern has to match the
part of the pattern up to the first glob character. For example, if
the pattern is `refs/heads/foo*bar`, then it can only match a
reference that has the prefix `refs/heads/foo`.
So pass that prefix to `for_each_fullref_in()`. This lets the ref code
avoid passing us the full set of refs, and in some cases avoid reading
them in the first place.
Note that this applies only when the `match_as_path` flag is set
(i.e., when `for-each-ref` is the caller), as the matching rules for
git-branch and git-tag are subtly different.
This could be generalized to the case of multiple patterns, but (a) it
probably doesn't come up that often, and (b) it is more awkward to
deal with multiple patterns (e.g., the patterns might not be
disjoint). So, since this is just an optimization, punt on the case of
multiple patterns.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to '.gitattributes')
0 files changed, 0 insertions, 0 deletions