diff options
author | Karthik Nayak <karthik.188@gmail.com> | 2017-01-10 14:19:52 +0530 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-01-31 12:43:04 -0800 |
commit | 949af0684c1f84587504e2143fca6f9bb8504e31 (patch) | |
tree | a54e7ba693e84d2a7e3837fd68df6e061721467f /pathspec.h | |
parent | branch, tag: use porcelain output (diff) | |
download | tgif-949af0684c1f84587504e2143fca6f9bb8504e31.tar.xz |
branch: use ref-filter printing APIs
Port branch.c to use ref-filter APIs for printing. This clears out
most of the code used in branch.c for printing and replaces them with
calls made to the ref-filter library.
Introduce build_format() which gets the format required for printing
of refs. Make amendments to print_ref_list() to reflect these changes.
The strings included in build_format() may not be safely quoted for
inclusion (i.e. it might contain '%' which needs to be escaped with an
additional '%'). Introduce quote_literal_for_format() as a helper
function which takes a string and returns a version of the string that
is safely quoted to be used in the for-each-ref format which is built
in build_format().
Change calc_maxwidth() to also account for the length of HEAD ref, by
calling ref-filter:get_head_discription().
Also change the test in t6040 to reflect the changes.
Before this patch, all cross-prefix symrefs weren't shortened. Since
we're using ref-filter APIs, we shorten all symrefs by default. We also
allow the user to change the format if needed with the introduction of
the '--format' option in the next patch.
Mentored-by: Christian Couder <christian.couder@gmail.com>
Mentored-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Helped-by: Junio C Hamano <gitster@pobox.com>
Helped-by: Jeff King <peff@peff.net>
Helped-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'pathspec.h')
0 files changed, 0 insertions, 0 deletions