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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Carlos Rica <jasampler@xxxxxxxxx> 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.
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux