From: Junio C Hamano Date: Sat, 01 Sep 2007 06:16:21 GMT Subject: Re: [PATCH] git-tag: Fix -l option to use better shell style globs. Message-ID: <7v8x7qvrka.fsf@gitster.siamese.dyndns.org> In-Reply-To: <46D8F431.70801@gmail.com> Carlos Rica writes: > 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.