]> git.ipfire.org Git - thirdparty/git.git/commit - ref-filter.c
ref-filter: implement %(if:equals=<string>) and %(if:notequals=<string>)
authorKarthik Nayak <karthik.188@gmail.com>
Tue, 10 Jan 2017 08:49:36 +0000 (14:19 +0530)
committerJunio C Hamano <gitster@pobox.com>
Tue, 10 Jan 2017 20:44:31 +0000 (12:44 -0800)
commit4f3e3b37fae818e0e370d14fd56479d3a7d68b6e
treeaebe8b78b2321e0fdc1cb5e1358b692e6d0ac693
parentc58fc85692d759cb33a59e138a94931044a08284
ref-filter: implement %(if:equals=<string>) and %(if:notequals=<string>)

Implement %(if:equals=<string>) wherein the if condition is only
satisfied if the value obtained between the %(if:...) and %(then) atom
is the same as the given '<string>'.

Similarly, implement (if:notequals=<string>) wherein the if condition
is only satisfied if the value obtained between the %(if:...) and
%(then) atom is different from the given '<string>'.

This is done by introducing 'if_atom_parser()' which parses the given
%(if) atom and then stores the data in used_atom which is later passed
on to the used_atom of the %(then) atom, so that it can do the required
comparisons.

Add tests and documentation for 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