git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 1/2] commit-graph: rename 'num_extra_edges' variable to 'num_large_edges'

From
Junio C Hamano <gitster@pobox.com>
Date
Nov 21, 2018, 03:29 UTC
Message-ID
<xmqqwop785wh.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<20181121012532.26878-1-szeder.dev@gmail.com>
SZEDER Gábor <szeder.dev@gmail.com> writes:
Show 13 quoted lines
> I rename these variables to 'num_large_edges', because the commit
> graph file format speaks about the 'Large Edge List' chunk.
>
> However, I do find that the term 'extra' makes much more sense and
> fits the concept better (i.e. extra commit graph edges resulting from
> the extra parents or octopus merges; after a s/extra/large/g the
> previous phrase would make no sense), and notice that the term 'large'
> doesn't come up in the file format itseld (the chunk's magic is {'E',
> 'D', 'G', 'E'}, there is no 'L' in there), but only in the
> specification text and a couple of variable and function names in the
> code.
>
> Would it make sense to do the rename in the other direction?

So edges that are involved in octopus merges are counted with num_extra_edges and written to the large edges table?

I tend to agree that "large edge" is a misnomer. These edges that point at third and subsequent parents are no larger than the edges that point at the first or the second parents---they are the same size. What is larger than usual is the size of the list of edges (i.e. the number of parents), because the commit has extra (compared to the majority of commits) number of edges. So from the point of view, I agree with you that "extra" makes a lot more sense than "large".

And the magic number being "EDGE" without "L" is probably a good thing, as a graph whose commits are all without any extra edge does not need the "EDGE" chunk, so presence of the chunk by itself is a sign that extra things are involved. Which means that there isn't any need to update the magic number, if we wanted to get rid of "large" and replace it with "extra". The only thing needed to update the documentation, variable names and in-code comment.

And while at it, GRAPH_OCTOPUS_EDGES_NEEDED may also want to be renamed with s/OCTOPUS/EXTRA/;

Show 84 quoted lines
>  commit-graph.c | 18 +++++++++---------
>  1 file changed, 9 insertions(+), 9 deletions(-)
>
> diff --git a/commit-graph.c b/commit-graph.c
> index 40c855f185..7b4e3a02cf 100644
> --- a/commit-graph.c
> +++ b/commit-graph.c
> @@ -475,7 +475,7 @@ static void write_graph_chunk_data(struct hashfile *f, int hash_len,
>  {
>  	struct commit **list = commits;
>  	struct commit **last = commits + nr_commits;
> -	uint32_t num_extra_edges = 0;
> +	uint32_t num_large_edges = 0;
>  
>  	while (list < last) {
>  		struct commit_list *parent;
> @@ -507,7 +507,7 @@ static void write_graph_chunk_data(struct hashfile *f, int hash_len,
>  		if (!parent)
>  			edge_value = GRAPH_PARENT_NONE;
>  		else if (parent->next)
> -			edge_value = GRAPH_OCTOPUS_EDGES_NEEDED | num_extra_edges;
> +			edge_value = GRAPH_OCTOPUS_EDGES_NEEDED | num_large_edges;
>  		else {
>  			edge_value = sha1_pos(parent->item->object.oid.hash,
>  					      commits,
> @@ -521,7 +521,7 @@ static void write_graph_chunk_data(struct hashfile *f, int hash_len,
>  
>  		if (edge_value & GRAPH_OCTOPUS_EDGES_NEEDED) {
>  			do {
> -				num_extra_edges++;
> +				num_large_edges++;
>  				parent = parent->next;
>  			} while (parent);
>  		}
> @@ -761,7 +761,7 @@ void write_commit_graph(const char *obj_dir,
>  	uint32_t chunk_ids[5];
>  	uint64_t chunk_offsets[5];
>  	int num_chunks;
> -	int num_extra_edges;
> +	int num_large_edges;
>  	struct commit_list *parent;
>  	struct progress *progress = NULL;
>  
> @@ -871,7 +871,7 @@ void write_commit_graph(const char *obj_dir,
>  	commits.alloc = count_distinct;
>  	ALLOC_ARRAY(commits.list, commits.alloc);
>  
> -	num_extra_edges = 0;
> +	num_large_edges = 0;
>  	for (i = 0; i < oids.nr; i++) {
>  		int num_parents = 0;
>  		if (i > 0 && oideq(&oids.list[i - 1], &oids.list[i]))
> @@ -885,11 +885,11 @@ void write_commit_graph(const char *obj_dir,
>  			num_parents++;
>  
>  		if (num_parents > 2)
> -			num_extra_edges += num_parents - 1;
> +			num_large_edges += num_parents - 1;
>  
>  		commits.nr++;
>  	}
> -	num_chunks = num_extra_edges ? 4 : 3;
> +	num_chunks = num_large_edges ? 4 : 3;
>  
>  	if (commits.nr >= GRAPH_PARENT_MISSING)
>  		die(_("too many commits to write graph"));
> @@ -916,7 +916,7 @@ void write_commit_graph(const char *obj_dir,
>  	chunk_ids[0] = GRAPH_CHUNKID_OIDFANOUT;
>  	chunk_ids[1] = GRAPH_CHUNKID_OIDLOOKUP;
>  	chunk_ids[2] = GRAPH_CHUNKID_DATA;
> -	if (num_extra_edges)
> +	if (num_large_edges)
>  		chunk_ids[3] = GRAPH_CHUNKID_LARGEEDGES;
>  	else
>  		chunk_ids[3] = 0;
> @@ -926,7 +926,7 @@ void write_commit_graph(const char *obj_dir,
>  	chunk_offsets[1] = chunk_offsets[0] + GRAPH_FANOUT_SIZE;
>  	chunk_offsets[2] = chunk_offsets[1] + GRAPH_OID_LEN * commits.nr;
>  	chunk_offsets[3] = chunk_offsets[2] + (GRAPH_OID_LEN + 16) * commits.nr;
> -	chunk_offsets[4] = chunk_offsets[3] + 4 * num_extra_edges;
> +	chunk_offsets[4] = chunk_offsets[3] + 4 * num_large_edges;
>  
>  	for (i = 0; i <= num_chunks; i++) {
>  		uint32_t chunk_write[3];
Previous: SZEDER GáborNext: Derrick Stolee
Message 57 of 133 in “commit-graph: add progress output”
  1. 0/2 commit-graph: add progress outputÆvar Arnfjörð Bjarmason, Sep 4, 2018
  2. 2/2 commit-graph verify: add progress outputÆvar Arnfjörð Bjarmason, Sep 4, 2018
  3. Junio C HamanoSep 4, 2018
  4. 1/2 commit-graph write: add progress outputÆvar Arnfjörð Bjarmason, Sep 4, 2018
  5. Eric SunshineSep 4, 2018
  6. Junio C HamanoSep 4, 2018
  7. Derrick StoleeSep 5, 2018
  8. Ævar Arnfjörð BjarmasonSep 5, 2018
  9. Junio C HamanoSep 5, 2018
  10. Derrick StoleeSep 5, 2018
  11. Ævar Arnfjörð BjarmasonSep 7, 2018
  12. Ævar Arnfjörð BjarmasonSep 7, 2018
  13. Jeff KingSep 7, 2018
  14. Derrick StoleeSep 7, 2018
  15. Derrick StoleeSep 5, 2018
  16. Ævar Arnfjörð BjarmasonSep 7, 2018
  17. Derrick StoleeSep 7, 2018
  18. Derrick StoleeSep 5, 2018
  19. 0/2 commit-graph: add progress outputÆvar Arnfjörð Bjarmason, Sep 7, 2018
  20. Junio C HamanoSep 11, 2018
  21. 1/2 commit-graph write: add progress outputÆvar Arnfjörð Bjarmason, Sep 7, 2018
  22. Derrick StoleeSep 21, 2018
  23. Junio C HamanoSep 21, 2018
  24. Junio C HamanoSep 21, 2018
  25. 2/2 commit-graph verify: add progress outputÆvar Arnfjörð Bjarmason, Sep 7, 2018
  26. Duy NguyenSep 16, 2018
  27. 0/2 commit-graph: add progress outputÆvar Arnfjörð Bjarmason, Sep 17, 2018
  28. 1/2 commit-graph write: add progress outputÆvar Arnfjörð Bjarmason, Sep 17, 2018
  29. SZEDER GáborOct 10, 2018
  30. Ævar Arnfjörð BjarmasonOct 10, 2018
  31. SZEDER GáborOct 10, 2018
  32. Ævar Arnfjörð BjarmasonOct 10, 2018
  33. Ævar Arnfjörð BjarmasonOct 11, 2018
  34. SZEDER GáborOct 15, 2018
  35. Junio C HamanoOct 12, 2018
  36. Ævar Arnfjörð BjarmasonOct 12, 2018
  37. Derrick StoleeOct 12, 2018
  38. SZEDER GáborOct 15, 2018
  39. SZEDER GáborNov 19, 2018
  40. commit-graph: split up close_reachable() progress outputÆvar Arnfjörð Bjarmason, Nov 19, 2018
  41. Derrick StoleeNov 19, 2018
  42. SZEDER GáborNov 19, 2018
  43. 0/6 commit-graph write: progress output improvementsÆvar Arnfjörð Bjarmason, Nov 20, 2018
  44. 1/6 commit-graph write: rephrase confusing progress outputÆvar Arnfjörð Bjarmason, Nov 20, 2018
  45. 2/6 commit-graph write: add more progress outputÆvar Arnfjörð Bjarmason, Nov 20, 2018
  46. SZEDER GáborNov 20, 2018
  47. 0/6 commit-graph write: progress output improvementsÆvar Arnfjörð Bjarmason, Nov 20, 2018
  48. 1/6 commit-graph write: rephrase confusing progress outputÆvar Arnfjörð Bjarmason, Nov 20, 2018
  49. 2/6 commit-graph write: add more progress outputÆvar Arnfjörð Bjarmason, Nov 20, 2018
  50. SZEDER GáborNov 20, 2018
  51. 3/6 commit-graph write: show progress for object searchÆvar Arnfjörð Bjarmason, Nov 20, 2018
  52. 4/6 commit-graph write: add more describing progress outputÆvar Arnfjörð Bjarmason, Nov 20, 2018
  53. 5/6 commit-graph write: remove empty line for readabilityÆvar Arnfjörð Bjarmason, Nov 20, 2018
  54. 6/6 commit-graph write: add even more progress outputÆvar Arnfjörð Bjarmason, Nov 20, 2018
  55. SZEDER Gábor, Nov 21, 2018
  56. 1/2 commit-graph: rename 'num_extra_edges' variable to 'num_large_edges'SZEDER Gábor, Nov 21, 2018
  57. Junio C HamanoNov 21, 2018
  58. Derrick StoleeNov 21, 2018
  59. 0/2 commit-graph: minor cleanup and optimizationSZEDER Gábor, Jan 18, 2019
  60. 1/2 commit-graph: rename "large edges" to "extra edges"SZEDER Gábor, Jan 18, 2019
  61. 2/2 commit-graph: don't call write_graph_chunk_large_edges() unnecessarilySZEDER Gábor, Jan 18, 2019
  62. Martin ÅgrenJan 19, 2019
  63. Junio C HamanoJan 18, 2019
  64. 2/2 commit-graph: don't call write_graph_chunk_large_edges() unnecessarilySZEDER Gábor, Nov 21, 2018
  65. Derrick StoleeNov 21, 2018
  66. 00/10 commit-graph write: progress output improvementsÆvar Arnfjörð Bjarmason, Nov 22, 2018
  67. 00/10 commit-graph write: progress output improvementsÆvar Arnfjörð Bjarmason, Nov 22, 2018
  68. 01/10 commit-graph: rename 'num_extra_edges' variable to 'num_large_edges'Ævar Arnfjörð Bjarmason, Nov 22, 2018
  69. 0/9 commit-graph write: progress output improvementsÆvar Arnfjörð Bjarmason, Jan 16, 2019
  70. Junio C HamanoJan 19, 2019
  71. 00/10 commit-graph write: progress output improvementsÆvar Arnfjörð Bjarmason, Jan 19, 2019
  72. Derrick StoleeJan 22, 2019
  73. Junio C HamanoJan 23, 2019
  74. Junio C HamanoJan 22, 2019
  75. 01/10 commit-graph write: use pack order when finding commitsÆvar Arnfjörð Bjarmason, Jan 19, 2019
  76. 02/10 commit-graph: rename "large edges" to "extra edges"Ævar Arnfjörð Bjarmason, Jan 19, 2019
  77. 03/10 commit-graph: don't call write_graph_chunk_large_edges() unnecessarilyÆvar Arnfjörð Bjarmason, Jan 19, 2019
  78. 03/10 commit-graph: don't call write_graph_chunk_extra_edges() unnecessarilySZEDER Gábor, Jan 23, 2019
  79. 04/10 commit-graph write: add "Writing out" progress outputÆvar Arnfjörð Bjarmason, Jan 19, 2019
  80. 05/10 commit-graph write: more descriptive "writing out" outputÆvar Arnfjörð Bjarmason, Jan 19, 2019
  81. 06/10 commit-graph write: show progress for object searchÆvar Arnfjörð Bjarmason, Jan 19, 2019
  82. 08/10 commit-graph write: remove empty line for readabilityÆvar Arnfjörð Bjarmason, Jan 19, 2019
  83. 07/10 commit-graph write: add more descriptive progress outputÆvar Arnfjörð Bjarmason, Jan 19, 2019
  84. 09/10 commit-graph write: add itermediate progressÆvar Arnfjörð Bjarmason, Jan 19, 2019
  85. 10/10 commit-graph write: emit a percentage for all progressÆvar Arnfjörð Bjarmason, Jan 19, 2019
  86. commit-graph: don't show progress percentages while expanding reachable commitsSZEDER Gábor, Mar 22, 2019
  87. Ævar Arnfjörð BjarmasonMar 22, 2019
  88. SZEDER GáborMar 22, 2019
  89. Ævar Arnfjörð BjarmasonMar 22, 2019
  90. Ævar Arnfjörð BjarmasonMar 22, 2019
  91. SZEDER GáborMar 22, 2019
  92. Ævar Arnfjörð BjarmasonMar 22, 2019
  93. SZEDER GáborMar 22, 2019
  94. SZEDER GáborMar 22, 2019
  95. Ævar Arnfjörð BjarmasonMar 22, 2019
  96. 1/9 commit-graph: rename 'num_extra_edges' variable to 'num_large_edges'Ævar Arnfjörð Bjarmason, Jan 16, 2019
  97. 2/9 commit-graph: don't call write_graph_chunk_large_edges() unnecessarilyÆvar Arnfjörð Bjarmason, Jan 16, 2019
  98. 3/9 commit-graph write: add "Writing out" progress outputÆvar Arnfjörð Bjarmason, Jan 16, 2019
  99. SZEDER GáborJan 18, 2019
  100. 4/9 commit-graph write: more descriptive "writing out" outputÆvar Arnfjörð Bjarmason, Jan 16, 2019
  101. 5/9 commit-graph write: show progress for object searchÆvar Arnfjörð Bjarmason, Jan 16, 2019
  102. 6/9 commit-graph write: add more descriptive progress outputÆvar Arnfjörð Bjarmason, Jan 16, 2019
  103. 7/9 commit-graph write: remove empty line for readabilityÆvar Arnfjörð Bjarmason, Jan 16, 2019
  104. 8/9 commit-graph write: add itermediate progressÆvar Arnfjörð Bjarmason, Jan 16, 2019
  105. 9/9 commit-graph write: emit a percentage for all progressÆvar Arnfjörð Bjarmason, Jan 16, 2019
  106. commit-graph write: use pack order when finding commitsÆvar Arnfjörð Bjarmason, Jan 17, 2019
  107. Derrick StoleeJan 17, 2019
  108. Derrick StoleeJan 17, 2019
  109. 02/10 commit-graph: don't call write_graph_chunk_large_edges() unnecessarilyÆvar Arnfjörð Bjarmason, Nov 22, 2018
  110. 03/10 commit-graph write: rephrase confusing progress outputÆvar Arnfjörð Bjarmason, Nov 22, 2018
  111. 05/10 commit-graph write: more descriptive "writing out" outputÆvar Arnfjörð Bjarmason, Nov 22, 2018
  112. 04/10 commit-graph write: add "Writing out" progress outputÆvar Arnfjörð Bjarmason, Nov 22, 2018
  113. 06/10 commit-graph write: show progress for object searchÆvar Arnfjörð Bjarmason, Nov 22, 2018
  114. 07/10 commit-graph write: add more descriptive progress outputÆvar Arnfjörð Bjarmason, Nov 22, 2018
  115. 08/10 commit-graph write: remove empty line for readabilityÆvar Arnfjörð Bjarmason, Nov 22, 2018
  116. 09/10 commit-graph write: add itermediate progressÆvar Arnfjörð Bjarmason, Nov 22, 2018
  117. 10/10 commit-graph write: emit a percentage for all progressÆvar Arnfjörð Bjarmason, Nov 22, 2018
  118. Eric SunshineNov 22, 2018
  119. 01/10 commit-graph: rename 'num_extra_edges' variable to 'num_large_edges'Ævar Arnfjörð Bjarmason, Nov 22, 2018
  120. 03/10 commit-graph write: rephrase confusing progress outputÆvar Arnfjörð Bjarmason, Nov 22, 2018
  121. 02/10 commit-graph: don't call write_graph_chunk_large_edges() unnecessarilyÆvar Arnfjörð Bjarmason, Nov 22, 2018
  122. 04/10 commit-graph write: add "Writing out" progress outputÆvar Arnfjörð Bjarmason, Nov 22, 2018
  123. 05/10 commit-graph write: more descriptive "writing out" outputÆvar Arnfjörð Bjarmason, Nov 22, 2018
  124. 06/10 commit-graph write: show progress for object searchÆvar Arnfjörð Bjarmason, Nov 22, 2018
  125. 07/10 commit-graph write: add more descriptive progress outputÆvar Arnfjörð Bjarmason, Nov 22, 2018
  126. 08/10 commit-graph write: remove empty line for readabilityÆvar Arnfjörð Bjarmason, Nov 22, 2018
  127. 09/10 commit-graph write: add itermediate progressÆvar Arnfjörð Bjarmason, Nov 22, 2018
  128. 10/10 commit-graph write: emit a percentage for all progressÆvar Arnfjörð Bjarmason, Nov 22, 2018
  129. 3/6 commit-graph write: show progress for object searchÆvar Arnfjörð Bjarmason, Nov 20, 2018
  130. 4/6 commit-graph write: add more describing progress outputÆvar Arnfjörð Bjarmason, Nov 20, 2018
  131. 5/6 commit-graph write: remove empty line for readabilityÆvar Arnfjörð Bjarmason, Nov 20, 2018
  132. 6/6 commit-graph write: add even more progress outputÆvar Arnfjörð Bjarmason, Nov 20, 2018
  133. 2/2 commit-graph verify: add progress outputÆvar Arnfjörð Bjarmason, Sep 17, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.