The object layer has "used" bit in the structure that is only used while running fsck. Remove it, and instead use one bit from the flags to record the fact that an object is referenced from some other object (only during fsck). Signed-off-by: Junio C Hamano <gitster@xxxxxxxxx> --- builtin/fsck.c | 7 ++++--- object.c | 1 - object.h | 3 +-- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/builtin/fsck.c b/builtin/fsck.c index 90f5c2c..dde0907 100644 --- a/builtin/fsck.c +++ b/builtin/fsck.c @@ -14,6 +14,7 @@ #define REACHABLE 0x0001 #define SEEN 0x0002 +#define USED 0x0004 static int show_root; static int show_tags; @@ -114,7 +115,7 @@ static int mark_object(struct object *obj, int type, void *data) static void mark_object_reachable(struct object *obj) { if (obj) { - obj->used = 1; + obj->flags |= USED; mark_object(obj, OBJ_ANY, NULL); } } @@ -156,7 +157,7 @@ static int mark_used(struct object *obj, int type, void *data) { if (!obj) return 1; - obj->used = 1; + obj->flags |= USED; return 0; } @@ -214,7 +215,7 @@ static void check_unreachable_object(struct object *obj) * deleted a branch by mistake, this is a prime candidate to * start looking at, for example. */ - if (!obj->used) { + if (!(obj->flags & USED)) { printf("dangling %s %s\n", typename(obj->type), sha1_to_hex(obj->sha1)); if (write_lost_and_found) { diff --git a/object.c b/object.c index 31976b5..4a9d77f 100644 --- a/object.c +++ b/object.c @@ -111,7 +111,6 @@ void *create_object(const unsigned char *sha1, int type, void *o) struct object *obj = o; obj->parsed = 0; - obj->used = 0; obj->type = type; obj->flags = 0; hashcpy(obj->sha1, sha1); diff --git a/object.h b/object.h index b6618d9..dbfc88f 100644 --- a/object.h +++ b/object.h @@ -19,14 +19,13 @@ struct object_array { #define OBJECT_ARRAY_INIT { 0, 0, NULL } #define TYPE_BITS 3 -#define FLAG_BITS 27 +#define FLAG_BITS (31-TYPE_BITS) /* * The object type is stored in 3 bits. */ struct object { unsigned parsed : 1; - unsigned used : 1; unsigned type : TYPE_BITS; unsigned flags : FLAG_BITS; unsigned char sha1[20]; -- 1.7.6 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html