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

Re: [PATCH 0/6] wildmatch part 2

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 4, 2012, 17:43 UTC
Message-ID
<7vwqz6yvyj.fsf@alter.siamese.dyndns.org>
In-Reply-To
<1349336392-1772-1-git-send-email-pclouds@gmail.com>
Nguyễn Thái Ngọc Duy <pclouds@gmail.com> writes:
Show 12 quoted lines
> On Thu, Oct 4, 2012 at 1:01 PM, Junio C Hamano <gitster@pobox.com> wrote:
>> Perhaps the wildmatch code may not be what we want X-<.
>
> When I imported wildmatch I was hoping to make minimum changes to it.
> But wildmatch is probably the only practical way to support "**" even
> if we later need to change it the way we want. Other options are base
> our work on top of compat/fnmatch.c, which is an #ifdef spaghetti
> mess, or write a new fnmatch()-compatible function. Both unattractive
> to me.
>
> Anyway, this is on top of nd/wildmatch, which makes "ab**cd" match
> full pathname.

I do not think we are in a hurry to push "**" support in before we know what semantics we want to get out of it. Pushing half-baked "this is good enough at least to me for now" topics before they are ready will cost the users in the longer term.

On the other hand, the three patches (2/3/4) in this series look like a good improvement regardless of what kind of matching engine we use. I would have preferred to see them _before_ nd/wildmatch.

I do not agree with the reasoning behind [1/6] that changes
	union {
		char *pattern;
		strict git_attr *attr;
	} u;
	char is_macro;
to
	char *pattern;
	strict git_attr *attr;
	char is_macro;
by the way.

The union is much less about space saving but is more about the nature of the usage; we use pattern or attr but not both at the same time. Even if the pattern becomes richer with later patches, that does not change the fundamental premise that depending on the value of "is_macro", either "attr" is used or "pattern" is used but they won't be in effect at the same time. The evolution of this should go more like this, I think:

	union {
		struct {
			const char *string;
			int pattern_length;
			int prefix_literal_length;
			int flags;
		} pattern;
		struct git_attr *attr;
	} u;
	char is_macro;
Thanks.
Previous: Junio C HamanoNext: Michael Haggerty
Message 17 of 28 in “What's cooking in git.git (Oct 2012, #01; Tue, 2)”
  1. Junio C HamanoOct 2, 2012
  2. Nguyen Thai Ngoc DuyOct 3, 2012
  3. Junio C HamanoOct 3, 2012
  4. Nguyen Thai Ngoc DuyOct 4, 2012
  5. Junio C HamanoOct 4, 2012
  6. 0/6 wildmatch part 2Nguyễn Thái Ngọc Duy, Oct 4, 2012
  7. 1/6 attr: remove the union in struct match_attrNguyễn Thái Ngọc Duy, Oct 4, 2012
  8. 2/6 attr: avoid strlen() on every matchNguyễn Thái Ngọc Duy, Oct 4, 2012
  9. 3/6 attr: avoid searching for basename on every matchNguyễn Thái Ngọc Duy, Oct 4, 2012
  10. 4/6 attr: more matching optimizations from .gitignoreNguyễn Thái Ngọc Duy, Oct 4, 2012
  11. 5/6 gitignore: do not do basename match with patterns that have '**'Nguyễn Thái Ngọc Duy, Oct 4, 2012
  12. Junio C HamanoOct 4, 2012
  13. Johannes SixtOct 5, 2012
  14. Nguyen Thai Ngoc DuyOct 5, 2012
  15. 6/6 t3001: note about expected "**" behaviorNguyễn Thái Ngọc Duy, Oct 4, 2012
  16. Junio C HamanoOct 4, 2012
  17. Junio C HamanoOct 4, 2012
  18. Michael HaggertyOct 4, 2012
  19. Nguyen Thai Ngoc DuyOct 4, 2012
  20. Michael HaggertyOct 4, 2012
  21. Junio C HamanoOct 4, 2012
  22. Andreas SchwabOct 5, 2012
  23. Matthieu MoyOct 5, 2012
  24. Andreas SchwabOct 5, 2012
  25. Nguyen Thai Ngoc DuyOct 5, 2012
  26. David Michael BarrOct 4, 2012
  27. Junio C HamanoOct 4, 2012
  28. Florian AchleitnerOct 30, 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.