Subject: Re: [PATCHv3 5/5] branch: allow pattern arguments

From: Michael Schubert <[email-masked]>
Date: Tue, 06 Sep 2011 15:10:54 +0200

On 08/28/2011 04:54 PM, Michael J Gruber wrote:
> +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.