Re: [PATCHv3 5/5] branch: allow pattern arguments
- From
- Michael Schubert <mschub@elegosoft.com>
- Date
- Sep 6, 2011, 13:10 UTC
- Message-ID
- <4E661BDE.1080204@elegosoft.com>
- In-Reply-To
- <0c487086643fbf0334140365f20fef62242b7dac.1314543252.git.git@drmicha.warpmail.net>
On 08/28/2011 04:54 PM, Michael J Gruber wrote:
Show 11 quoted lines
> +static int match_patterns(const char **pattern, const char *refname)
> +{
> + if (!*pattern)
> + return 1; /* no pattern always matches */
> + while (*pattern) {
> + if (!fnmatch(*pattern, refname, 0))
> + return 1;
> + pattern++;
> + }
> + return 0;
> +}Nitpick: maybe builtin/branch.c and builtin/tag.c could share match_pattern().?
A second thought: the printed "remotes/" prefix could be confusing for users, since it seems to be part of the refname. For example:
$ git branch -a * master maint man remotes/origin/master remotes/origin/maint remotes/origin/man
$ git branch -a --list remotes/origin* [no output]
but
$ git branch -a --list origin* remotes/origin/master remotes/origin/maint remotes/origin/man
(Sorry in case I missed that) What's the reason you decided --list to show local branches only? Maybe --list could show all refnames without any extra prefix.?
Thanks.