]> git.ipfire.org Git - thirdparty/git.git/commit - ref-filter.h
ref-filter.h: add functions for filter/format & format-only
authorVictoria Dye <vdye@github.com>
Tue, 14 Nov 2023 19:53:52 +0000 (19:53 +0000)
committerJunio C Hamano <gitster@pobox.com>
Thu, 16 Nov 2023 05:02:59 +0000 (14:02 +0900)
commite7574b0c6b1e0cf2de9e000766a13d23fd9516e6
treeeea6d4b3510f6f7d3d60215d67ddcba89a29aa14
parent6d6e5c53b0c3d5566680ee8786d40405db917917
ref-filter.h: add functions for filter/format & format-only

Add two new public methods to 'ref-filter.h':

* 'print_formatted_ref_array()' which, given a format specification & array
  of ref items, formats and prints the items to stdout.
* 'filter_and_format_refs()' which combines 'filter_refs()',
  'ref_array_sort()', and 'print_formatted_ref_array()' into a single
  function.

This consolidates much of the code used to filter and format refs in
'builtin/for-each-ref.c', 'builtin/tag.c', and 'builtin/branch.c', reducing
duplication and simplifying the future changes needed to optimize the filter
& format process.

Signed-off-by: Victoria Dye <vdye@github.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/branch.c
builtin/for-each-ref.c
builtin/tag.c
ref-filter.c
ref-filter.h