From e7b432c521b0177e86eaecd2bd16906b9fc53e10 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Fri, 30 Aug 2013 16:37:55 -0700 Subject: revision: introduce --exclude= to tame wildcards People often find "git log --branches" etc. that includes _all_ branches is cumbersome to use when they want to grab most but except some. The same applies to --tags, --all and --glob. Teach the revision machinery to remember patterns, and then upon the next such a globbing option, exclude those that match the pattern. With this, I can view only my integration branches (e.g. maint, master, etc.) without topic branches, which are named after two letters from primary authors' names, slash and topic name. git rev-list --no-walk --exclude=??/* --branches | git name-rev --refs refs/heads/* --stdin This one shows things reachable from local and remote branches that have not been merged to the integration branches. git log --remotes --branches --not --exclude=??/* --branches It may be a bit rough around the edges, in that the pattern to give the exclude option depends on what globbing option follows. In these examples, the pattern "??/*" is used, not "refs/heads/??/*", because the globbing option that follows the -"-exclude=" is "--branches". As each use of globbing option resets previously set "--exclude", this may not be such a bad thing, though. Signed-off-by: Junio C Hamano --- revision.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'revision.h') diff --git a/revision.h b/revision.h index 95859ba119..b4dc56c3ca 100644 --- a/revision.h +++ b/revision.h @@ -59,6 +59,9 @@ struct rev_info { /* The end-points specified by the end user */ struct rev_cmdline_info cmdline; + /* excluding from --branches, --refs, etc. expansion */ + struct string_list *ref_excludes; + /* Basic information */ const char *prefix; const char *def; -- cgit v1.2.3 From ff32d3420a550d3811e745af7f2ccc77fb026b7b Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Fri, 1 Nov 2013 12:02:45 -0700 Subject: rev-list --exclude: export add/clear-ref-exclusion and ref-excluded API ... while updating their function signature. To be squashed into the initial patch to rev-list. Signed-off-by: Junio C Hamano --- revision.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'revision.h') diff --git a/revision.h b/revision.h index b4dc56c3ca..c67c46d716 100644 --- a/revision.h +++ b/revision.h @@ -192,6 +192,11 @@ struct rev_info { struct decoration line_log_data; }; +extern int ref_excluded(struct string_list *, const char *path); +void clear_ref_exclusion(struct string_list **); +void add_ref_exclusion(struct string_list **, const char *exclude); + + #define REV_TREE_SAME 0 #define REV_TREE_NEW 1 /* Only new files */ #define REV_TREE_OLD 2 /* Only files removed */ -- cgit v1.2.3