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

Re: [PATCH] gitignore: warn about pointless syntax

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 9, 2012, 19:43 UTC
Message-ID
<7vhb04ek6e.fsf@alter.siamese.dyndns.org>
In-Reply-To
<20120109162802.GA2374@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 11 quoted lines
> On Mon, Jan 09, 2012 at 04:40:47PM +0100, Jan Engelhardt wrote:
>
>> +static inline void check_bogus_wildcard(const char *file, const char *p)
>> +{
>> +	if (strstr(p, "**") == NULL)
>> +		return;
>> +	warning(_("Pattern \"%s\" from file \"%s\": Double asterisk does not "
>> +		"have a special meaning and is interpreted just like a single "
>> +		"asterisk.\n"), file, p);
>
> Wouldn't this also match the meaningful "foo\**"?
Yes.

But trying to catch that false positive by checking one before "**" against a backslash is not a way to do so as it will then turn "foo\\**" into a false negative, and you would end up reimplementing fnmatch if you really want to avoid false positives nor negatives. At that point, you may be better off implementing git_fnmatch() instead that understands the double-asterisk that works as some people may expect it to work ;-).

Previous: Jeff KingNext: Jeff King
Message 4 of 11 in “gitignore warn about ** submission”
  1. Jan EngelhardtJan 9, 2012
  2. gitignore: warn about pointless syntaxJan Engelhardt, Jan 9, 2012
  3. Jeff KingJan 9, 2012
  4. Junio C HamanoJan 9, 2012
  5. Jeff KingJan 9, 2012
  6. Jan EngelhardtJan 10, 2012
  7. Junio C HamanoJan 10, 2012
  8. Jan EngelhardtJan 10, 2012
  9. Jan EngelhardtJan 10, 2012
  10. Thomas RastJan 10, 2012
  11. Jeff KingJan 10, 2012

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.