All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4 00/16] port branch.c to use ref-filter's printing options
@ 2016-04-09 18:44 Karthik Nayak
  2016-04-09 18:45 ` [PATCH v4 01/16] ref-filter: implement %(if), %(then), and %(else) atoms Karthik Nayak
                   ` (15 more replies)
  0 siblings, 16 replies; 31+ messages in thread
From: Karthik Nayak @ 2016-04-09 18:44 UTC (permalink / raw)
  To: git; +Cc: jacob.keller, gitster, Karthik Nayak

This is part of unification of the commands 'git tag -l, git branch -l
and git for-each-ref'. This ports over branch.c to use ref-filter's
printing options.

Initially posted here: $(gmane/279226). It was decided that this series
would follow up after refactoring ref-filter parsing mechanism, which
is now merged into master (9606218b32344c5c756f7c29349d3845ef60b80c).

v1 can be found here: $(gmane/288342)
v2 can be found here: $(gmane/288863)
v3 can be found here: $(gmane/290299)

Changes in this version:
1. Rebased on top of Erics changes, this was breaking tests. Thanks
to Dennis Kaarsemaker and Ramsay Jones for reporting this in.
2. Show local branch symrefs if available, changed this in the format
for `git branch -l`.

Thanks to Junio, Matthieu, Dennis and Ramsay for all suggestions on the
previous iteration.

Karthik Nayak (16):
  ref-filter: implement %(if), %(then), and %(else) atoms
  ref-filter: include reference to 'used_atom' within 'atom_value'
  ref-filter: implement %(if:equals=<string>) and
    %(if:notequals=<string>)
  ref-filter: modify "%(objectname:short)" to take length
  ref-filter: move get_head_description() from branch.c
  ref-filter: introduce format_ref_array_item()
  ref-filter: make %(upstream:track) prints "[gone]" for invalid
    upstreams
  ref-filter: add support for %(upstream:track,nobracket)
  ref-filter: make "%(symref)" atom work with the ':short' modifier
  ref-filter: introduce symref_atom_parser()
  ref-filter: introduce refname_atom_parser()
  ref-filter: add support for %(refname:dir) and %(refname:base)
  ref-filter: allow porcelain to translate messages in the output
  branch, tag: use porcelain output
  branch: use ref-filter printing APIs
  branch: implement '--format' option

 Documentation/git-branch.txt       |   7 +-
 Documentation/git-for-each-ref.txt |  63 +++++-
 builtin/branch.c                   | 268 ++++++----------------
 builtin/tag.c                      |   2 +
 ref-filter.c                       | 447 +++++++++++++++++++++++++++++++------
 ref-filter.h                       |   7 +
 t/t3203-branch-output.sh           |  12 +
 t/t6040-tracking-info.sh           |   2 +-
 t/t6300-for-each-ref.sh            |  40 +++-
 t/t6302-for-each-ref-filter.sh     |  94 ++++++++
 10 files changed, 664 insertions(+), 278 deletions(-)

Interdiff:

diff --git a/builtin/branch.c b/builtin/branch.c
index fb05b39..665ee57 100644
--- a/builtin/branch.c
+++ b/builtin/branch.c
@@ -320,7 +320,8 @@ static char *build_format(struct ref_filter *filter, int maxwidth, const char *r
 			    branch_get_color(BRANCH_COLOR_REMOTE), maxwidth,
 			    remote_prefix, branch_get_color(BRANCH_COLOR_RESET));
 	} else {
-		strbuf_addf(&local, "%%(refname:strip=2)%s", branch_get_color(BRANCH_COLOR_RESET));
+		strbuf_addf(&local, "%%(refname:strip=2)%s%%(if)%%(symref)%%(then) -> %%(symref:short)%%(end)",
+			    branch_get_color(BRANCH_COLOR_RESET));
 		strbuf_addf(&remote, "%s%s%%(refname:strip=2)%s%%(if)%%(symref)%%(then) -> %%(symref:short)%%(end)",
 			    branch_get_color(BRANCH_COLOR_REMOTE), remote_prefix, branch_get_color(BRANCH_COLOR_RESET));
 	}
diff --git a/t/t6302-for-each-ref-filter.sh b/t/t6302-for-each-ref-filter.sh
index 841f0c1..206ad67 100755
--- a/t/t6302-for-each-ref-filter.sh
+++ b/t/t6302-for-each-ref-filter.sh
@@ -349,6 +349,8 @@ test_expect_success 'check %(if)...%(then)...%(end) atoms' '
 	A U Thor: refs/heads/side
 	A U Thor: refs/odd/spot
 	
+	
+	
 	A U Thor: refs/tags/foo1.10
 	A U Thor: refs/tags/foo1.3
 	A U Thor: refs/tags/foo1.6
@@ -367,7 +369,9 @@ test_expect_success 'check %(if)...%(then)...%(else)...%(end) atoms' '
 	A U Thor: refs/heads/master
 	A U Thor: refs/heads/side
 	A U Thor: refs/odd/spot
-	No author: refs/tags/double-tag
+	No author: refs/tags/annotated-tag
+	No author: refs/tags/doubly-annotated-tag
+	No author: refs/tags/doubly-signed-tag
 	A U Thor: refs/tags/foo1.10
 	A U Thor: refs/tags/foo1.3
 	A U Thor: refs/tags/foo1.6
@@ -385,7 +389,9 @@ test_expect_success 'ignore spaces in %(if) atom usage' '
 	master: Head ref
 	side: Not Head ref
 	odd/spot: Not Head ref
-	double-tag: Not Head ref
+	annotated-tag: Not Head ref
+	doubly-annotated-tag: Not Head ref
+	doubly-signed-tag: Not Head ref
 	foo1.10: Not Head ref
 	foo1.3: Not Head ref
 	foo1.6: Not Head ref


-- 
2.8.0

^ permalink raw reply related	[flat|nested] 31+ messages in thread

end of thread, other threads:[~2016-04-17 20:31 UTC | newest]

Thread overview: 31+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-09 18:44 [PATCH v4 00/16] port branch.c to use ref-filter's printing options Karthik Nayak
2016-04-09 18:45 ` [PATCH v4 01/16] ref-filter: implement %(if), %(then), and %(else) atoms Karthik Nayak
2016-04-09 18:45 ` [PATCH v4 02/16] ref-filter: include reference to 'used_atom' within 'atom_value' Karthik Nayak
2016-04-09 18:45 ` [PATCH v4 03/16] ref-filter: implement %(if:equals=<string>) and %(if:notequals=<string>) Karthik Nayak
2016-04-09 18:45 ` [PATCH v4 04/16] ref-filter: modify "%(objectname:short)" to take length Karthik Nayak
2016-04-09 18:45 ` [PATCH v4 05/16] ref-filter: move get_head_description() from branch.c Karthik Nayak
2016-04-09 18:45 ` [PATCH v4 06/16] ref-filter: introduce format_ref_array_item() Karthik Nayak
2016-04-09 18:45 ` [PATCH v4 07/16] ref-filter: make %(upstream:track) prints "[gone]" for invalid upstreams Karthik Nayak
2016-04-09 18:45 ` [PATCH v4 08/16] ref-filter: add support for %(upstream:track,nobracket) Karthik Nayak
2016-04-09 18:45 ` [PATCH v4 09/16] ref-filter: make "%(symref)" atom work with the ':short' modifier Karthik Nayak
2016-04-09 18:45 ` [PATCH v4 10/16] ref-filter: introduce symref_atom_parser() Karthik Nayak
2016-04-09 18:45 ` [PATCH v4 11/16] ref-filter: introduce refname_atom_parser() Karthik Nayak
2016-04-14 20:43   ` Jeff King
2016-04-15 19:02     ` Karthik Nayak
2016-04-09 18:45 ` [PATCH v4 12/16] ref-filter: add support for %(refname:dir) and %(refname:base) Karthik Nayak
2016-04-09 18:45 ` [PATCH v4 13/16] ref-filter: allow porcelain to translate messages in the output Karthik Nayak
2016-04-09 18:45 ` [PATCH v4 14/16] branch, tag: use porcelain output Karthik Nayak
2016-04-09 18:45 ` [PATCH v4 15/16] branch: use ref-filter printing APIs Karthik Nayak
2016-04-12 20:40   ` Junio C Hamano
2016-04-12 21:05     ` Junio C Hamano
2016-04-13 10:49       ` Karthik Nayak
     [not found]         ` <CAPc5daUZvP03o+eb2ngvRtV=aoXWGnZH9FKj9bRCEj3MrCT8WQ@mail.gmail.com>
2016-04-13 19:01           ` Karthik Nayak
2016-04-13 22:05             ` Jeff King
2016-04-14 19:17               ` Karthik Nayak
2016-04-14 20:05                 ` Jeff King
2016-04-14 20:36                   ` Jeff King
2016-04-15 20:27                     ` Karthik Nayak
2016-04-15 21:09                       ` Jeff King
2016-04-16  0:11   ` Stefan Beller
2016-04-17 20:30     ` Karthik Nayak
2016-04-09 18:45 ` [PATCH v4 16/16] branch: implement '--format' option Karthik Nayak

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.