]> git.ipfire.org Git - thirdparty/git.git/commit - ref-filter.c
ref-filter: move ref_sorting flags to a bitfield
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>
Thu, 7 Jan 2021 09:51:51 +0000 (10:51 +0100)
committerJunio C Hamano <gitster@pobox.com>
Thu, 7 Jan 2021 23:13:21 +0000 (15:13 -0800)
commit7c269a7b162027d0465d52203e778903a2ddbdbf
treef36f9bd2273e9dce33d596752aa99d73d18940b1
parentd0947483a3386204918447775b617ab3dac833b0
ref-filter: move ref_sorting flags to a bitfield

Change the reverse/ignore_case/version sort flags in the ref_sorting
struct into a bitfield. Having three of them was already a bit
unwieldy, but it would be even more so if another flag needed a
function like ref_sorting_icase_all() introduced in
76f9e569adb (ref-filter: apply --ignore-case to all sorting keys,
2020-05-03).

A follow-up change will introduce such a flag, so let's move this over
to a bitfield. Instead of using the usual '#define' pattern I'm using
the "enum" pattern from builtin/rebase.c's b4c8eb024af (builtin
rebase: support --quiet, 2018-09-04).

Perhaps there's a more idiomatic way of doing the "for each in list
amend mask" pattern than this "mask/on" variable combo. This function
doesn't allow us to e.g. do any arbitrary changes to the bitfield for
multiple flags, but I think in this case that's fine. The common case
is that we're calling this with a list of one.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.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