Skip to content

Commit

Permalink
dir.c::match_pathname(): adjust patternlen when shifting pattern
Browse files Browse the repository at this point in the history
If we receive a pattern that starts with "/", we shift it
forward to avoid looking at the "/" part. Since the prefix
and patternlen parameters are counts of what is in the
pattern, we must decrement them as we increment the pointer.

We remembered to handle prefix, but not patternlen. This
didn't cause any bugs, though, because the patternlen
parameter is not actually used. Since it will be used in
future patches, let's correct this oversight.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Jeff King authored and Junio C Hamano committed Mar 29, 2013
1 parent 0b6e56d commit 982ac87
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -597,6 +597,7 @@ int match_pathname(const char *pathname, int pathlen,
*/
if (*pattern == '/') {
pattern++;
patternlen--;
prefix--;
}

Expand Down

0 comments on commit 982ac87

Please sign in to comment.