path: root/Documentation/git-for-each-ref.txt
diff options
authorKarthik Nayak <>2017-01-10 08:49:52 (GMT)
committerJunio C Hamano <>2017-01-31 20:43:04 (GMT)
commit949af0684c1f84587504e2143fca6f9bb8504e31 (patch)
treea54e7ba693e84d2a7e3837fd68df6e061721467f /Documentation/git-for-each-ref.txt
parent56b43607f975841e70203e55bba3c0b0228da6b0 (diff)
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 <> Mentored-by: Matthieu Moy <> Helped-by: Junio C Hamano <> Helped-by: Jeff King <> Helped-by: Ramsay Jones <> Signed-off-by: Karthik Nayak <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'Documentation/git-for-each-ref.txt')
0 files changed, 0 insertions, 0 deletions