Note that there are these disadvantages in the ref-filter code: 1. Scattered state variables: need_tagged, need_symref are placed globally, need_color_reset_at_eol is placed inside ref_format. 2. parse_sorting_atom() uses a dummy ref_format, which causes us to need a lot of extra logic to check in verify_ref_format(), because dummy ref_format records some state, while truly ref_format does not. 3. struct ref_sorting uses a very strange singly linked list implementation, and there is a memory leak with it. Therefore, the following modifications are made to make the logic of ref-filter cleaner: 1. Let ref_sorting use list api. 2. Eliminate dummy ref_format. 3. Add ref_format to ref_array_item. 4. Move the check in verify_ref_format() to atom parsing function. 5. Add deref member to used_atom. 6. Move need_symref, need_tagged to ref_format. ZheNing Hu (8): [GSOC] ref-filter: use list api to replace ref_sorting linked list [GSOC] ref-filter: let parse_sorting_atom() use real ref_format [GSOC] ref-filter: add ref_format to ref_array_item [GSOC] ref-filter: clean up verify_ref_format() [GSOC] ref-filter: introduce symref_atom_parser() [GSOC] ref-filter: remove grab_oid() function [GSOC] ref-filter: add deref member to struct used_atom [GSOC] ref-filter: move need_symref, need_tagged into ref_format builtin/branch.c | 26 +++-- builtin/for-each-ref.c | 20 ++-- builtin/ls-remote.c | 18 ++-- builtin/tag.c | 24 +++-- ref-filter.c | 236 +++++++++++++++++++++-------------------- ref-filter.h | 20 ++-- 6 files changed, 185 insertions(+), 159 deletions(-) base-commit: c4203212e360b25a1c69467b5a8437d45a373cac Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-1025%2Fadlternative%2Fref-filter-code-clean-v1 Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1025/adlternative/ref-filter-code-clean-v1 Pull-Request: https://github.com/gitgitgadget/git/pull/1025 -- gitgitgadget