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

Re: [PATCH] common_prefix: be more careful about pathspec bounds

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 15, 2010, 22:12 UTC
Message-ID
<7vaaqwgd2q.fsf@alter.siamese.dyndns.org>
In-Reply-To
<201006152004.01507.trast@student.ethz.ch>
Thomas Rast <trast@student.ethz.ch> writes:
> I really didn't like the two-interleaved-loops version in your last
> mail, but this one is way more readable than even the original.
>
> (Why did you wrap the for loop? It's only 76 chars.)
Because I was writing it in my MUA ;-)
Show 11 quoted lines
>
> Maybe you could add a comment like
>
>> 	slash = strrchr(path, '/');
>> 	if (!slash)
>> 		return 0;
> 	/* The first 'prefix' characters of 'path' always include the
> 	   trailing slash of the prefix directory */
>> 	prefix = slash - path + 1;
>
> to clean up any doubts about the correctness of the matching.
Perhaps..
Previous: Thomas RastNext: Thomas Rast
Message 7 of 8 in “common_prefix: be more careful about pathspec bounds”
  1. common_prefix: be more careful about pathspec boundsThomas Rast, Jun 10, 2010
  2. Thomas RastJun 15, 2010
  3. Johannes SchindelinJun 15, 2010
  4. Junio C HamanoJun 15, 2010
  5. Junio C HamanoJun 15, 2010
  6. Thomas RastJun 15, 2010
  7. Junio C HamanoJun 15, 2010
  8. common_prefix: simplify and fix scanning for prefixesThomas Rast, Jun 15, 2010

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.