aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/commitgraph/CommitGraphConstants.java
blob: 8d2789cf52e780da3e82da1c05507ba76a8f699a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/*
 * Copyright (C) 2021, Tencent.
 *
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Distribution License v. 1.0 which is available at
 * https://www.eclipse.org/org/documents/edl-v10.php.
 *
 * SPDX-License-Identifier: BSD-3-Clause
 */

package org.eclipse.jgit.internal.storage.commitgraph;

/**
 * Constants relating to commit-graph.
 */
class CommitGraphConstants {

	static final int COMMIT_GRAPH_MAGIC = 0x43475048; /* "CGPH" */

	static final int CHUNK_ID_OID_FANOUT = 0x4f494446; /* "OIDF" */

	static final int CHUNK_ID_OID_LOOKUP = 0x4f49444c; /* "OIDL" */

	static final int CHUNK_ID_COMMIT_DATA = 0x43444154; /* "CDAT" */

	static final int CHUNK_ID_EXTRA_EDGE_LIST = 0x45444745; /* "EDGE" */

	static final int CHUNK_ID_BLOOM_FILTER_INDEX = 0x42494458; /* "BIDX" */

	static final int CHUNK_ID_BLOOM_FILTER_DATA = 0x42444154; /* "BDAT" */

	/**
	 * First 4 bytes describe the chunk id. Value 0 is a terminating label.
	 * Other 8 bytes provide the byte-offset in current file for chunk to start.
	 */
	static final int CHUNK_LOOKUP_WIDTH = 12;

	/**
	 * First 8 bytes are for the positions of the first two parents of the ith
	 * commit. The next 8 bytes store the generation number of the commit and
	 * the commit time in seconds since EPOCH.
	 */
	static final int COMMIT_DATA_WIDTH = 16;

	/** Mask to make the last edgeValue into position */
	static final int GRAPH_EDGE_LAST_MASK = 0x7fffffff;

	/** EdgeValue & GRAPH_LAST_EDGE != 0 means it is the last edgeValue */
	static final int GRAPH_LAST_EDGE = 0x80000000;

	/** EdgeValue == GRAPH_NO_PARENT means it has no parents */
	static final int GRAPH_NO_PARENT = 0x70000000;

	/**
	 * EdgeValue & GRAPH_EXTRA_EDGES_NEEDED != 0 means its other parents are
	 * in Chunk Extra Edge List
	 */
	static final int GRAPH_EXTRA_EDGES_NEEDED = 0x80000000;
}