]> git.ipfire.org Git - thirdparty/git.git/commit - ref-filter.c
ref-filter: implement %(if), %(then), and %(else) atoms
authorKarthik Nayak <karthik.188@gmail.com>
Tue, 10 Jan 2017 08:49:34 +0000 (14:19 +0530)
committerJunio C Hamano <gitster@pobox.com>
Tue, 10 Jan 2017 20:44:30 +0000 (12:44 -0800)
commitc58492d4347fb6ee68fbb59b40e34ffde4dc2389
tree1a381c301e49e029f183f71a420d1096837d91a4
parent1d1bdafd64266e5ee3bd46c6965228f32e4022ea
ref-filter: implement %(if), %(then), and %(else) atoms

Implement %(if), %(then) and %(else) atoms. Used as
%(if)...%(then)...%(end) or %(if)...%(then)...%(else)...%(end). If the
format string between %(if) and %(then) expands to an empty string, or
to only whitespaces, then the whole %(if)...%(end) expands to the string
following %(then). Otherwise, it expands to the string following
%(else), if any. Nesting of this construct is possible.

This is in preparation for porting over `git branch -l` to use
ref-filter APIs for printing.

Add documentation and tests regarding the same.

Mentored-by: Christian Couder <christian.couder@gmail.com>
Mentored-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/git-for-each-ref.txt
ref-filter.c
t/t6302-for-each-ref-filter.sh