diff options
author | Derrick Stolee <dstolee@microsoft.com> | 2018-04-25 16:37:55 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-05-22 05:36:25 +0200 |
commit | 83073cc994cc3cd364f3f213478b9162476e8e44 (patch) | |
tree | e5b239f23a72baa58e0dd3a76f8fc391a6ca2fb1 /commit.h | |
parent | ref-filter: fix outdated comment on in_commit_list (diff) | |
download | git-83073cc994cc3cd364f3f213478b9162476e8e44.tar.xz git-83073cc994cc3cd364f3f213478b9162476e8e44.zip |
commit: add generation number to struct commit
The generation number of a commit is defined recursively as follows:
* If a commit A has no parents, then the generation number of A is one.
* If a commit A has parents, then the generation number of A is one
more than the maximum generation number among the parents of A.
Add a uint32_t generation field to struct commit so we can pass this
information to revision walks. We use three special values to signal
the generation number is invalid:
GENERATION_NUMBER_INFINITY 0xFFFFFFFF
GENERATION_NUMBER_MAX 0x3FFFFFFF
GENERATION_NUMBER_ZERO 0
The first (_INFINITY) means the generation number has not been loaded or
computed. The second (_MAX) means the generation number is too large to
store in the commit-graph file. The third (_ZERO) means the generation
number was loaded from a commit graph file that was written by a version
of git that did not support generation numbers.
Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'commit.h')
-rw-r--r-- | commit.h | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -10,6 +10,9 @@ #include "pretty.h" #define COMMIT_NOT_FROM_GRAPH 0xFFFFFFFF +#define GENERATION_NUMBER_INFINITY 0xFFFFFFFF +#define GENERATION_NUMBER_MAX 0x3FFFFFFF +#define GENERATION_NUMBER_ZERO 0 struct commit_list { struct commit *item; @@ -30,6 +33,7 @@ struct commit { */ struct tree *maybe_tree; uint32_t graph_pos; + uint32_t generation; }; extern int save_commit_buffer; |