Re: [RFC PATCH v2 1/4] object: remove "used" field from struct object
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jul 20, 2017, 21:20 UTC
- Message-ID
- <xmqqk232kdoo.fsf@gitster.mtv.corp.google.com>
- In-Reply-To
- <0eb270f40095f132bf9383f230506e45d895e5e1.1500508695.git.jonathantanmy@google.com>
Jonathan Tan <jonathantanmy@google.com> writes:
Show 9 quoted lines
> The "used" field in struct object is only used by builtin/fsck. Remove > that field and modify builtin/fsck to use a flag instead. > > Signed-off-by: Jonathan Tan <jonathantanmy@google.com> > --- > builtin/fsck.c | 24 ++++++++++++++---------- > object.c | 1 - > object.h | 2 +- > 3 files changed, 15 insertions(+), 12 deletions(-)
I vaguely recall trying to do this myself a few years ago. We can easily spot places within this file that does things like this:
> - obj->flags = HAS_OBJ;
and correctly update it to this:
> + obj->flags &= ~(REACHABLE | SEEN); > + obj->flags |= HAS_OBJ;
but I didn't do so because I was hesitant having to validate, and having to maintain the invariant forever, that anything called from these codepaths is always careful not to clobber the USED bit.
Looks like a reasonable preparatory clean-up that probably should be doable and should be done way before the main part of the series to me. Will queue, together with your other fsck change.
Thanks.