]> git.ipfire.org Git - thirdparty/git.git/commit
ref-filter.c: refactor to create common helper functions
authorVictoria Dye <vdye@github.com>
Tue, 14 Nov 2023 19:53:54 +0000 (19:53 +0000)
committerJunio C Hamano <gitster@pobox.com>
Thu, 16 Nov 2023 05:03:00 +0000 (14:03 +0900)
commit613d9915499ed9d1fd21d743002d17ef972e9e57
tree8fe0c6b56cbcf8c5f985d558899d955f9f427627
parent9c575b020232c5af0d2068aa82ce390923b81646
ref-filter.c: refactor to create common helper functions

Factor out parts of 'ref_array_push()', 'ref_filter_handler()', and
'filter_refs()' into new helper functions:

* Extract the code to grow a 'struct ref_array' and append a given 'struct
  ref_array_item *' to it from 'ref_array_push()' into 'ref_array_append()'.
* Extract the code to filter a given ref by refname & object ID then create
  a new 'struct ref_array_item *' from 'filter_one()' into
  'apply_ref_filter()'.
* Extract the code for filter pre-processing, contains cache creation, and
  ref iteration from 'filter_refs()' into 'do_filter_refs()'.

In later patches, these helpers will be used by new ref-filter API
functions. This patch does not result in any user-facing behavior changes or
changes to callers outside of 'ref-filter.c'.

Signed-off-by: Victoria Dye <vdye@github.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
ref-filter.c