]> git.ipfire.org Git - thirdparty/git.git/commit
builtin/repack.c: avoid directly inspecting "util"
authorTaylor Blau <me@ttaylorr.com>
Wed, 13 Sep 2023 19:18:00 +0000 (15:18 -0400)
committerJunio C Hamano <gitster@pobox.com>
Wed, 13 Sep 2023 19:32:48 +0000 (12:32 -0700)
commit4a17e97246470049b8bde5be0d767ef66e550555
treec85d9bd049f3ecef8b39dab61e4627518b4fb05c
parenteabfaf8e8db27dd76ec1f1d4e0a2a124374475ab
builtin/repack.c: avoid directly inspecting "util"

The `->util` field corresponding to each string_list_item is used to
track the existence of some pack at the beginning of a repack operation
was originally intended to be used as a bitfield.

This bitfield tracked:

  - (1 << 0): whether or not the pack should be deleted
  - (1 << 1): whether or not the pack is cruft

The previous commit removed the use of the second bit, but a future
patch (from a different series than this one) will introduce a new use
of it.

So we could stop treating the util pointer as a bitfield and instead
start treating it as if it were a boolean. But this would require some
backtracking when that later patch is applied.

Instead, let's avoid touching the ->util field directly, and instead
introduce convenience functions like:

  - pack_mark_for_deletion()
  - pack_is_marked_for_deletion()

Helped-by: Junio C Hamano <gitster@pobox.com>
Helped-by: Jeff King <peff@peff.net>
Helped-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/repack.c