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

Re: [PATCH] git-tag: Fix -l option to use better shell style globs.

From
Junio C Hamano <gitster@pobox.com>
Date
Sep 1, 2007, 06:16 UTC
Message-ID
<7v8x7qvrka.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<46D8F431.70801@gmail.com>
Carlos Rica <jasampler@gmail.com> writes:
Show 13 quoted lines
>  	if (pattern == NULL)
> -		pattern = "";
> +		pattern = "*";
>
> -	/* prepend/append * to the shell pattern: */
> -	newpattern = xmalloc(strlen(pattern) + 3);
> -	sprintf(newpattern, "*%s*", pattern);
> -
> -	filter.pattern = newpattern;
> +	filter.pattern = pattern;
>  	filter.lines = lines;
>
>  	for_each_tag_ref(show_reference, (void *) &filter);

I think it is conceptually simpler on the show_reference side to allow (filter.pattern == NULL) and say:

	if (!filter->pattern || !fnmatch(filter->pattern, refname, 0)) {
        	... show that ref ...
	}

It is not such a big deal now you do not do newpattern allocation anymore, so I'll apply the patch as is.

Previous: Junio C HamanoNext: Carlos Rica
Message 4 of 6 in “git-tag: Fix -l option to use better shell style globs.”
  1. git-tag: Fix -l option to use better shell style globs.Carlos Rica, Sep 1, 2007
  2. Shawn O. PearceSep 1, 2007
  3. Junio C HamanoSep 1, 2007
  4. Junio C HamanoSep 1, 2007
  5. Carlos RicaSep 1, 2007
  6. Carlos RicaSep 1, 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.