Re: [RFC PATCH v2 1/4] object: remove "used" field from struct object
From: Junio C Hamano <hidden>
Date: 2017-07-20 21:21:04
Jonathan Tan [off-list ref] writes:
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 <redacted> --- 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.