The optional 'Large Edge List' chunk of the commit graph file stores
parent information for commits with more than two parents, and the
names of most of the macros, variables, struct fields, and functions
related to this chunk contain the term "large edges", e.g.
write_graph_chunk_large_edges(). However, it's not a really great
term, as the edges to the second and subsequent parents stored in this
chunk are not any larger than the edges to the first and second
parents stored in the "main" 'Commit Data' chunk. It's the number of
edges, IOW number of parents, that is larger compared to non-merge and
"regular" two-parent merge commits. And indeed, two functions in
'commit-graph.c' have a local variable called 'num_extra_edges' that
refer to the same thing, and this "extra edges" term is much better at
describing these edges.
So let's rename all these references to "large edges" in macro,
variable, function, etc. names to "extra edges". There is a
GRAPH_OCTOPUS_EDGES_NEEDED macro as well; for the sake of consistency
rename it to GRAPH_EXTRA_EDGES_NEEDED.
We can do so safely without causing any incompatibility issues,
because the term "large edges" doesn't come up in the file format
itself in any form (the chunk's magic is {'E', 'D', 'G', 'E'}, there
is no 'L' in there), but only in the specification text. The string
"large edges", however, does come up in the output of 'git
commit-graph read' and in tests looking at its input, but that command
is explicitly documented as debugging aid, so we can change its output
and the affected tests safely.
Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
raw | patch | inline | side by side (parent: d7574c9 )
of the ith commit. Stores value 0x7000000 if no parent in that
position. If there are more than two parents, the second value
has its most-significant bit on and the other bits store an array
of the ith commit. Stores value 0x7000000 if no parent in that
position. If there are more than two parents, the second value
has its most-significant bit on and the other bits store an array
- position into the Large Edge List chunk.
+ position into the Extra Edge List chunk.
* The next 8 bytes store the generation number of the commit and
the commit time in seconds since EPOCH. The generation number
uses the higher 30 bits of the first 4 bytes, while the commit
* The next 8 bytes store the generation number of the commit and
the commit time in seconds since EPOCH. The generation number
uses the higher 30 bits of the first 4 bytes, while the commit
2 bits of the lowest byte, storing the 33rd and 34th bit of the
commit time.
2 bits of the lowest byte, storing the 33rd and 34th bit of the
commit time.
- Large Edge List (ID: {'E', 'D', 'G', 'E'}) [Optional]
+ Extra Edge List (ID: {'E', 'D', 'G', 'E'}) [Optional]
This list of 4-byte values store the second through nth parents for
all octopus merges. The second parent value in the commit data stores
an array position within this list along with the most-significant bit
This list of 4-byte values store the second through nth parents for
all octopus merges. The second parent value in the commit data stores
an array position within this list along with the most-significant bit
printf(" oid_lookup");
if (graph->chunk_commit_data)
printf(" commit_metadata");
printf(" oid_lookup");
if (graph->chunk_commit_data)
printf(" commit_metadata");
- if (graph->chunk_large _edges)
- printf(" large _edges");
+ if (graph->chunk_extra _edges)
+ printf(" extra _edges");
printf("\n");
UNLEAK(graph);
printf("\n");
UNLEAK(graph);
#define GRAPH_CHUNKID_OIDFANOUT 0x4f494446 /* "OIDF" */
#define GRAPH_CHUNKID_OIDLOOKUP 0x4f49444c /* "OIDL" */
#define GRAPH_CHUNKID_DATA 0x43444154 /* "CDAT" */
#define GRAPH_CHUNKID_OIDFANOUT 0x4f494446 /* "OIDF" */
#define GRAPH_CHUNKID_OIDLOOKUP 0x4f49444c /* "OIDL" */
#define GRAPH_CHUNKID_DATA 0x43444154 /* "CDAT" */
-#define GRAPH_CHUNKID_LARGE EDGES 0x45444745 /* "EDGE" */
+#define GRAPH_CHUNKID_EXTRA EDGES 0x45444745 /* "EDGE" */
#define GRAPH_DATA_WIDTH 36
#define GRAPH_DATA_WIDTH 36
#define GRAPH_OID_VERSION GRAPH_OID_VERSION_SHA1
#define GRAPH_OID_LEN GRAPH_OID_LEN_SHA1
#define GRAPH_OID_VERSION GRAPH_OID_VERSION_SHA1
#define GRAPH_OID_LEN GRAPH_OID_LEN_SHA1
-#define GRAPH_OCTOPUS _EDGES_NEEDED 0x80000000
+#define GRAPH_EXTRA _EDGES_NEEDED 0x80000000
#define GRAPH_PARENT_MISSING 0x7fffffff
#define GRAPH_EDGE_LAST_MASK 0x7fffffff
#define GRAPH_PARENT_NONE 0x70000000
#define GRAPH_PARENT_MISSING 0x7fffffff
#define GRAPH_EDGE_LAST_MASK 0x7fffffff
#define GRAPH_PARENT_NONE 0x70000000
graph->chunk_commit_data = data + chunk_offset;
break;
graph->chunk_commit_data = data + chunk_offset;
break;
- case GRAPH_CHUNKID_LARGE EDGES:
- if (graph->chunk_large _edges)
+ case GRAPH_CHUNKID_EXTRA EDGES:
+ if (graph->chunk_extra _edges)
- graph->chunk_large _edges = data + chunk_offset;
+ graph->chunk_extra _edges = data + chunk_offset;
edge_value = get_be32(commit_data + g->hash_len + 4);
if (edge_value == GRAPH_PARENT_NONE)
return 1;
edge_value = get_be32(commit_data + g->hash_len + 4);
if (edge_value == GRAPH_PARENT_NONE)
return 1;
- if (!(edge_value & GRAPH_OCTOPUS _EDGES_NEEDED)) {
+ if (!(edge_value & GRAPH_EXTRA _EDGES_NEEDED)) {
pptr = insert_parent_or_die(g, edge_value, pptr);
return 1;
}
pptr = insert_parent_or_die(g, edge_value, pptr);
return 1;
}
- parent_data_ptr = (uint32_t*)(g->chunk_large _edges +
+ parent_data_ptr = (uint32_t*)(g->chunk_extra _edges +
4 * (uint64_t)(edge_value & GRAPH_EDGE_LAST_MASK));
do {
edge_value = get_be32(parent_data_ptr);
4 * (uint64_t)(edge_value & GRAPH_EDGE_LAST_MASK));
do {
edge_value = get_be32(parent_data_ptr);
if (!parent)
edge_value = GRAPH_PARENT_NONE;
else if (parent->next)
if (!parent)
edge_value = GRAPH_PARENT_NONE;
else if (parent->next)
- edge_value = GRAPH_OCTOPUS _EDGES_NEEDED | num_extra_edges;
+ edge_value = GRAPH_EXTRA _EDGES_NEEDED | num_extra_edges;
else {
edge_value = sha1_pos(parent->item->object.oid.hash,
commits,
else {
edge_value = sha1_pos(parent->item->object.oid.hash,
commits,
hashwrite_be32(f, edge_value);
hashwrite_be32(f, edge_value);
- if (edge_value & GRAPH_OCTOPUS _EDGES_NEEDED) {
+ if (edge_value & GRAPH_EXTRA _EDGES_NEEDED) {
do {
num_extra_edges++;
parent = parent->next;
do {
num_extra_edges++;
parent = parent->next;
-static void write_graph_chunk_large _edges(struct hashfile *f,
+static void write_graph_chunk_extra _edges(struct hashfile *f,
struct commit **commits,
int nr_commits)
{
struct commit **commits,
int nr_commits)
{
chunk_ids[1] = GRAPH_CHUNKID_OIDLOOKUP;
chunk_ids[2] = GRAPH_CHUNKID_DATA;
if (num_extra_edges)
chunk_ids[1] = GRAPH_CHUNKID_OIDLOOKUP;
chunk_ids[2] = GRAPH_CHUNKID_DATA;
if (num_extra_edges)
- chunk_ids[3] = GRAPH_CHUNKID_LARGE EDGES;
+ chunk_ids[3] = GRAPH_CHUNKID_EXTRA EDGES;
else
chunk_ids[3] = 0;
chunk_ids[4] = 0;
else
chunk_ids[3] = 0;
chunk_ids[4] = 0;
write_graph_chunk_fanout(f, commits.list, commits.nr);
write_graph_chunk_oids(f, GRAPH_OID_LEN, commits.list, commits.nr);
write_graph_chunk_data(f, GRAPH_OID_LEN, commits.list, commits.nr);
write_graph_chunk_fanout(f, commits.list, commits.nr);
write_graph_chunk_oids(f, GRAPH_OID_LEN, commits.list, commits.nr);
write_graph_chunk_data(f, GRAPH_OID_LEN, commits.list, commits.nr);
- write_graph_chunk_large _edges(f, commits.list, commits.nr);
+ write_graph_chunk_extra _edges(f, commits.list, commits.nr);
close_commit_graph(the_repository);
finalize_hashfile(f, NULL, CSUM_HASH_IN_STREAM | CSUM_FSYNC);
close_commit_graph(the_repository);
finalize_hashfile(f, NULL, CSUM_HASH_IN_STREAM | CSUM_FSYNC);
const uint32_t *chunk_oid_fanout;
const unsigned char *chunk_oid_lookup;
const unsigned char *chunk_commit_data;
const uint32_t *chunk_oid_fanout;
const unsigned char *chunk_oid_lookup;
const unsigned char *chunk_commit_data;
- const unsigned char *chunk_large _edges;
+ const unsigned char *chunk_extra _edges;
};
struct commit_graph *load_commit_graph_one(const char *graph_file);
};
struct commit_graph *load_commit_graph_one(const char *graph_file);
cd "$TRASH_DIRECTORY/full" &&
git commit-graph write &&
test_path_is_file $objdir/info/commit-graph &&
cd "$TRASH_DIRECTORY/full" &&
git commit-graph write &&
test_path_is_file $objdir/info/commit-graph &&
- graph_read_expect "10" "large _edges"
+ graph_read_expect "10" "extra _edges"
'
graph_git_behavior 'merge 1 vs 2' full merge/1 merge/2
'
graph_git_behavior 'merge 1 vs 2' full merge/1 merge/2
cd "$TRASH_DIRECTORY/full" &&
git commit-graph write &&
test_path_is_file $objdir/info/commit-graph &&
cd "$TRASH_DIRECTORY/full" &&
git commit-graph write &&
test_path_is_file $objdir/info/commit-graph &&
- graph_read_expect "11" "large _edges"
+ graph_read_expect "11" "extra _edges"
'
graph_git_behavior 'full graph, commit 8 vs merge 1' full commits/8 merge/1
'
graph_git_behavior 'full graph, commit 8 vs merge 1' full commits/8 merge/1
cd "$TRASH_DIRECTORY/full" &&
git commit-graph write &&
test_path_is_file $objdir/info/commit-graph &&
cd "$TRASH_DIRECTORY/full" &&
git commit-graph write &&
test_path_is_file $objdir/info/commit-graph &&
- graph_read_expect "11" "large _edges"
+ graph_read_expect "11" "extra _edges"
'
graph_git_behavior 'cleared graph, commit 8 vs merge 1' full commits/8 merge/1
'
graph_git_behavior 'cleared graph, commit 8 vs merge 1' full commits/8 merge/1
cd "$TRASH_DIRECTORY/full" &&
cat new-idx | git commit-graph write --stdin-packs &&
test_path_is_file $objdir/info/commit-graph &&
cd "$TRASH_DIRECTORY/full" &&
cat new-idx | git commit-graph write --stdin-packs &&
test_path_is_file $objdir/info/commit-graph &&
- graph_read_expect "9" "large _edges"
+ graph_read_expect "9" "extra _edges"
'
graph_git_behavior 'graph from pack, commit 8 vs merge 1' full commits/8 merge/1
'
graph_git_behavior 'graph from pack, commit 8 vs merge 1' full commits/8 merge/1
cd "$TRASH_DIRECTORY/full" &&
git rev-parse merge/3 | git commit-graph write --stdin-commits --append &&
test_path_is_file $objdir/info/commit-graph &&
cd "$TRASH_DIRECTORY/full" &&
git rev-parse merge/3 | git commit-graph write --stdin-commits --append &&
test_path_is_file $objdir/info/commit-graph &&
- graph_read_expect "10" "large _edges"
+ graph_read_expect "10" "extra _edges"
'
graph_git_behavior 'append graph, commit 8 vs merge 1' full commits/8 merge/1
'
graph_git_behavior 'append graph, commit 8 vs merge 1' full commits/8 merge/1
cd "$TRASH_DIRECTORY/full" &&
git commit-graph write --reachable &&
test_path_is_file $objdir/info/commit-graph &&
cd "$TRASH_DIRECTORY/full" &&
git commit-graph write --reachable &&
test_path_is_file $objdir/info/commit-graph &&
- graph_read_expect "11" "large _edges"
+ graph_read_expect "11" "extra _edges"
'
graph_git_behavior 'append graph, commit 8 vs merge 1' full commits/8 merge/1
'
graph_git_behavior 'append graph, commit 8 vs merge 1' full commits/8 merge/1
cd "$TRASH_DIRECTORY/bare" &&
git commit-graph write &&
test_path_is_file $baredir/info/commit-graph &&
cd "$TRASH_DIRECTORY/bare" &&
git commit-graph write &&
test_path_is_file $baredir/info/commit-graph &&
- graph_read_expect "11" "large _edges"
+ graph_read_expect "11" "extra _edges"
'
graph_git_behavior 'bare repo with graph, commit 8 vs merge 1' bare commits/8 merge/1
'
graph_git_behavior 'bare repo with graph, commit 8 vs merge 1' bare commits/8 merge/1