Re: [RFC/PATCH] tag: make list exclude !<pattern>
From: Tom Grennan <hidden>
Date: 2016-06-15 22:53:02
On Fri, 10 Feb 2012 10:55:16 -0800, Tom Grennan wrote:
On Fri, Feb 10, 2012 at 01:34:26PM +0700, Nguyen Thai Ngoc Duy wrote:quoted
On Fri, Feb 10, 2012 at 2:43 AM, Tom Grennan [off-list ref] wrote:quoted
Please see the following patch which filters the tag list of "!" prefaced patterns. If this is deemed desirable and correct, I'll resubmit with updated documentation and unit tests.git-branch, git-tag and git-for-each-ref are in the same family. I think it's good to that all three commands share things, like this pattern matching.Yes, git-branch and git-tag could now use a common match_patterns() but git-for-each-ref needs some rearranging; as will: git-describe, git-replace, git-ls-remote, git-name-rev, and git-show-branch. If we pursue this, it may be best to first add match_patterns() to ./refs.[ch] then incrementally modify these builtin commands to use it.
The following series implements !<pattern> with: git-tag, git-branch, and git-for-each-ref. This still requires Documentation and unit test updates but I think these are close to functionally complete.
quoted
About the '!' for exclusion, maybe it's better to move from fnmatch() as matching machinery to pathspec. Then when git learns negative pathspec [1], we have this feature for free. [1] http://thread.gmane.org/gmane.comp.version-control.git/189645/focus=190072
After looking at this some more, I don't understand the value of replacing libc:fnmatch(). Or are you just referring to '--exclude' instead of [!]<pattern> argument parsing? --- Tom Grennan (4): refs: add common refname_match_patterns() tag: use refs.c:refname_match_patterns() branch: use refs.c:refname_match_patterns() for-each-ref: use refs.c:refname_match_patterns() Documentation/git-tag.txt | 10 ++++++---- builtin/branch.c | 16 ++-------------- builtin/for-each-ref.c | 23 +++-------------------- builtin/tag.c | 15 ++------------- refs.c | 14 ++++++++++++++ refs.h | 8 ++++++++ 6 files changed, 35 insertions(+), 51 deletions(-) -- 1.7.8