summaryrefslogtreecommitdiff
path: root/object.h
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2018-04-14 15:35:01 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-04-16 03:38:58 (GMT)
commitfd9b1baef8a940c9c251995b006a3d96f210e639 (patch)
tree2f9bd735fc03a7fcd6c0626f4d4f6ba191511d21 /object.h
parent8d6ccce14fd1a5843f5c9b231d4dcb81f6ceeb25 (diff)
downloadgit-fd9b1baef8a940c9c251995b006a3d96f210e639.zip
git-fd9b1baef8a940c9c251995b006a3d96f210e639.tar.gz
git-fd9b1baef8a940c9c251995b006a3d96f210e639.tar.bz2
pack-objects: turn type and in_pack_type to bitfields
An extra field type_valid is added to carry the equivalent of OBJ_BAD in the original "type" field. in_pack_type always contains a valid type so we only need 3 bits for it. A note about accepting OBJ_NONE as "valid" type. The function read_object_list_from_stdin() can pass this value [1] and it eventually calls create_object_entry() where current code skip setting "type" field if the incoming type is zero. This does not have any bad side effects because "type" field should be memset()'d anyway. But since we also need to set type_valid now, skipping oe_set_type() leaves type_valid zero/false, which will make oe_type() return OBJ_BAD, not OBJ_NONE anymore. Apparently we do care about OBJ_NONE in prepare_pack(). This switch from OBJ_NONE to OBJ_BAD may trigger fatal: unable to get type of object ... Accepting OBJ_NONE [2] does sound wrong, but this is how it is has been for a very long time and I haven't time to dig in further. [1] See 5c49c11686 (pack-objects: better check_object() performances - 2007-04-16) [2] 21666f1aae (convert object type handling from a string to a number - 2007-02-26) Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'object.h')
-rw-r--r--object.h1
1 files changed, 0 insertions, 1 deletions
diff --git a/object.h b/object.h
index f13f85b..3d305fe 100644
--- a/object.h
+++ b/object.h
@@ -25,7 +25,6 @@ struct object_array {
#define OBJECT_ARRAY_INIT { 0, 0, NULL }
-#define TYPE_BITS 3
/*
* object flag allocation:
* revision.h: 0---------10 26