commit.h: delete 'util' field in struct commit
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>
Sat, 19 May 2018 05:28:31 +0000 (07:28 +0200)
committerJunio C Hamano <gitster@pobox.com>
Mon, 21 May 2018 05:07:21 +0000 (14:07 +0900)
If you have come this far, you probably have seen that this 'util'
pointer is used for many different purposes. Some are not even
contained in a command code, but buried deep in common code with no
clue who will use it and how.

The move to using commit-slab gives us a much better picture of how
some piece of data is associated with a commit and what for. Since
nobody uses 'util' pointer anymore, we can retire so that nobody will
abuse it again. commit-slab will be the way forward for associating
data to a commit.

As a side benefit, this shrinks struct commit by 8 bytes (on 64-bit
architecture) which should help reduce memory usage for reachability
test a bit. This is also what commit-slab is invented for [1].

[1] 96c4f4a370 (commit: allow associating auxiliary info on-demand -
2013-04-09)

Signed-off-by: Junio C Hamano <gitster@pobox.com>
commit.h
index 838f6a6b266e220711653c4e67d6c8fe6d725196..4432458367f16ca23336737ee4d4e111aca85f06 100644 (file)
--- a/commit.h
+++ b/commit.h
@@ -16,9 +16,13 @@ struct commit_list {
        struct commit_list *next;
 };
 
+/*
+ * The size of this struct matters in full repo walk operations like
+ * 'git clone' or 'git gc'. Consider using commit-slab to attach data
+ * to a commit instead of adding new fields here.
+ */
 struct commit {
        struct object object;
-       void *util;
        unsigned int index;
        timestamp_t date;
        struct commit_list *parents;