diff options
author | Junio C Hamano <gitster@pobox.com> | 2013-03-28 17:47:28 -0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2013-03-28 21:48:12 -0700 |
commit | 0b6e56dfe6c7f75c2a02cc0cf8731c9e62b6d3d1 (patch) | |
tree | 412658ee18221a111f188f765f4223243c8712f0 /t/t4013/diff.diff-tree_--pretty_--root_--stat_--summary_initial | |
parent | attr.c::path_matches(): special case paths that end with a slash (diff) | |
download | tgif-0b6e56dfe6c7f75c2a02cc0cf8731c9e62b6d3d1.tar.xz |
dir.c::match_basename(): pay attention to the length of string parameters
The function takes two counted strings (<basename, basenamelen> and
<pattern, patternlen>) as parameters, together with prefix (the
length of the prefix in pattern that is to be matched literally
without globbing against the basename) and EXC_* flags that tells it
how to match the pattern against the basename.
However, it did not pay attention to the length of these counted
strings. Update them to do the following:
* When the entire pattern is to be matched literally, the pattern
matches the basename only when the lengths of them are the same,
and they match up to that length.
* When the pattern is "*" followed by a string to be matched
literally, make sure that the basenamelen is equal or longer than
the "literal" part of the pattern, and the tail of the basename
string matches that literal part.
* Otherwise, use the new fnmatch_icase_mem helper to make
sure we only lookmake sure we use only look at the
counted part of the strings. Because these counted strings are
full strings most of the time, we check for termination
to avoid unnecessary allocation.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t4013/diff.diff-tree_--pretty_--root_--stat_--summary_initial')
0 files changed, 0 insertions, 0 deletions