From: Lars Knoll <lars@trolltech.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: "Morten Welinder" <mwelinder@gmail.com>,
git@vger.kernel.org, "Pierre Habouzit" <madcoder@debian.org>
Subject: Re: [PATCH] Speedup scanning for excluded files.
Date: Tue, 30 Oct 2007 09:28:49 +0200 [thread overview]
Message-ID: <200710300828.49840.lars@trolltech.com> (raw)
In-Reply-To: <7vzly1sc7p.fsf@gitster.siamese.dyndns.org>
On Tuesday 30 October 2007, Junio C Hamano wrote:
> "Morten Welinder" <mwelinder@gmail.com> writes:
> >> + } else if (x->flags & EXC_FLAG_ENDSWITH)
> >> { + if (!strcmp(exclude + 1,
> >> pathname + pathlen -x->patternlen + 1))
> >
> > Is there some guarantee that the result of that subtraction is still
> > within the string?
>
> Good eyes.
>
> If pattern is "*.exe", patternlen is 5, and strcmp wants to
> compare 4 chars, so pathlen is better be at least that long, and
> we do allow that pattern to match a hidden file ".exe".
>
> Like this?
>
> if (x->patternlen - 1 <= pathlen &&
> !strcmp(exclude + 1, pathname + pathlen - x->patternlen + 1))
> return to_exclude;
Yes, that looks right. Thanks for catching that one.
Lars
next prev parent reply other threads:[~2007-10-30 7:29 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-29 7:45 [PATCH] Speedup scanning for excluded files Lars Knoll
2007-10-29 8:02 ` Pierre Habouzit
2007-10-29 8:59 ` Lars Knoll
2007-10-29 22:17 ` Junio C Hamano
2007-10-29 22:59 ` Morten Welinder
2007-10-30 0:00 ` Junio C Hamano
2007-10-30 7:28 ` Lars Knoll [this message]
2007-10-30 7:46 ` [PATCH v3] " Lars Knoll
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200710300828.49840.lars@trolltech.com \
--to=lars@trolltech.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=madcoder@debian.org \
--cc=mwelinder@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.