]> git.ipfire.org Git - thirdparty/git.git/commit - ref-filter.c
ref-filter: introduce ref_formatting_state and ref_formatting_stack
authorKarthik Nayak <karthik.188@gmail.com>
Thu, 10 Sep 2015 15:48:18 +0000 (21:18 +0530)
committerJunio C Hamano <gitster@pobox.com>
Thu, 17 Sep 2015 17:02:48 +0000 (10:02 -0700)
commit574e96a2418cce16934f2b6e20a0af5ff5f85c92
tree4cc9c9a64c8579515511009209cef8280fb43696
parent3a25761a5eb01d797f85621b5844a4eea5a02377
ref-filter: introduce ref_formatting_state and ref_formatting_stack

Introduce ref_formatting_state which will hold the formatted output
strbuf instead of directly printing to stdout. This will help us in
creating modifier atoms which modify the format specified before
printing to stdout.

Implement a stack machinery for ref_formatting_state, this allows us
to push and pop elements onto the stack. Whenever we pop an element
from the stack, the strbuf from that element is appended to the strbuf
of the next element on the stack, this will allow us to support
nesting of modifier atoms.

Rename some functions to reflect the changes made:
print_value() -> append_atom()
emit()        -> append_literal()

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>
ref-filter.c