git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] Speedup scanning for excluded files.

From
LKLars Knoll <lars@trolltech.com>
Date
Oct 30, 2007, 07:28 UTC
Message-ID
<200710300828.49840.lars@trolltech.com>
In-Reply-To
<7vzly1sc7p.fsf@gitster.siamese.dyndns.org>
On Tuesday 30 October 2007, Junio C Hamano wrote:
Show 19 quoted lines
> "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
Previous: Junio C HamanoNext: Lars Knoll
Message 7 of 8 in “Speedup scanning for excluded files.”
  1. Speedup scanning for excluded files.Lars Knoll, Oct 29, 2007
  2. Pierre HabouzitOct 29, 2007
  3. Lars KnollOct 29, 2007
  4. Junio C HamanoOct 29, 2007
  5. Morten WelinderOct 29, 2007
  6. Junio C HamanoOct 30, 2007
  7. Lars KnollOct 30, 2007
  8. Speedup scanning for excluded files.Lars Knoll, Oct 30, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.