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

Re: [PATCH v3 00/33] nd/sha1-name-c-wo-the-repository updates

From
SZEDER Gábor <szeder.dev@gmail.com>
Date
Apr 11, 2019, 20:51 UTC
Message-ID
<20190411205146.GK8796@szeder.dev>
In-Reply-To
<nycvar.QRO.7.76.6.1904102254500.41@tvgsbejvaqbjf.bet>
On Wed, Apr 10, 2019 at 10:56:52PM +0200, Johannes Schindelin wrote:
Show 53 quoted lines
> Hi Duy,
> 
> On Sat, 6 Apr 2019, Nguyễn Thái Ngọc Duy wrote:
> 
> > 10:  68876a150f ! 11:  848456f59c commit.c: add repo_get_commit_tree()
> >     @@ -2,6 +2,11 @@
> >
> >          commit.c: add repo_get_commit_tree()
> >
> >     +    Remove the implicit dependency on the_repository in this function.
> >     +    It will be used in sha1-name.c functions when they are updated to take
> >     +    any 'struct repository'. get_commit_tree() remains as a compat wrapper,
> >     +    to be slowly replaced later.
> >     +
> >       diff --git a/commit.c b/commit.c
> >       --- a/commit.c
> >       +++ b/commit.c
> >     @@ -29,6 +34,15 @@
> >       --- a/commit.h
> >       +++ b/commit.h
> >      @@
> >     +
> >     + 	/*
> >     + 	 * If the commit is loaded from the commit-graph file, then this
> >     +-	 * member may be NULL. Only access it through get_commit_tree()
> >     ++	 * member may be NULL. Only access it through repo_get_commit_tree()
> >     + 	 * or get_commit_tree_oid().
> >     + 	 */
> >     + 	struct tree *maybe_tree;
> >     +@@
> >        */
> >       void free_commit_buffer(struct parsed_object_pool *pool, struct commit *);
> >
> >     @@ -57,3 +71,10 @@
> >         ...>}
> >
> >       @@
> >     + expression c;
> >     ++expression r;
> >     + expression s;
> >     + @@
> >     +-- get_commit_tree(c) = s
> >     ++- repo_get_commit_tree(r, c) = s
> >     + + c->maybe_tree = s
> 
> I think this is wrong, and admittedly I had the very same version
> originally.
> 
> When you have an arbitrary `r` in any `repo_get_commit_tree(r, c)` (as
> opposed to `the_repository`), the conversion to `c->maybe_tree` is most
> likely incorrect.
> 
> Therefore, I don't think that we can do that.

So, as far as I understand, the goal of these 'c->maybe_tree'-related semantic patches is to prevent "generic" parts of Git from accessing this field directly, as it might not be initialized in a commit-graph-enabled repository.

Only three functions are explicitly exempt, while this last semantic patch in question implicitly allows a few more that assign a value to 'c->maybe_tree'. These functions are release_commit_memory() and parse_commit_buffer() in 'commit.c' and fill_commit_in_graph() in 'commit-graph.c', and after a quick look these functions seem to be rather fundamenal in the life-cycle of a commit object.

I think they deserve to be explicitly exempted, too, and then we could remove this last semantic patch altogether.

Previous: Johannes SchindelinNext: SZEDER Gábor
Message 110 of 153 in “Kill the_repository in sha1-name.c”
  1. 00/31 Kill the_repository in sha1-name.cNguyễn Thái Ngọc Duy, Mar 30, 2019
  2. 01/31 packfile.c: add repo_approximate_object_count()Nguyễn Thái Ngọc Duy, Mar 30, 2019
  3. 02/31 refs.c: add refs_ref_exists()Nguyễn Thái Ngọc Duy, Mar 30, 2019
  4. 03/31 refs.c: add refs_shorten_unambiguous_ref()Nguyễn Thái Ngọc Duy, Mar 30, 2019
  5. 04/31 refs.c: remove the_repo from substitute_branch_name()Nguyễn Thái Ngọc Duy, Mar 30, 2019
  6. 05/31 refs.c: remove the_repo from expand_ref()Nguyễn Thái Ngọc Duy, Mar 30, 2019
  7. 06/31 refs.c: add repo_dwim_ref()Nguyễn Thái Ngọc Duy, Mar 30, 2019
  8. 07/31 refs.c: add repo_dwim_log()Nguyễn Thái Ngọc Duy, Mar 30, 2019
  9. 08/31 refs.c: remove the_repo from read_ref_at()Nguyễn Thái Ngọc Duy, Mar 30, 2019
  10. 09/31 commit.c: add repo_get_commit_tree()Nguyễn Thái Ngọc Duy, Mar 30, 2019
  11. SZEDER GáborApr 2, 2019
  12. 10/31 sha1-name.c: remove the_repo from sort_ambiguous()Nguyễn Thái Ngọc Duy, Mar 30, 2019
  13. 11/31 sha1-name.c: remove the_repo from find_abbrev_len_packed()Nguyễn Thái Ngọc Duy, Mar 30, 2019
  14. 12/31 sha1-name.c: add repo_find_unique_abbrev_r()Nguyễn Thái Ngọc Duy, Mar 30, 2019
  15. 13/31 sha1-name.c: store and use repo in struct disambiguate_stateNguyễn Thái Ngọc Duy, Mar 30, 2019
  16. 14/31 sha1-name.c: add repo_for_each_abbrev()Nguyễn Thái Ngọc Duy, Mar 30, 2019
  17. 15/31 sha1-name.c: remove the_repo from get_short_oid()Nguyễn Thái Ngọc Duy, Mar 30, 2019
  18. 16/31 sha1-name.c: remove the_repo from interpret_nth_prior_checkout()Nguyễn Thái Ngọc Duy, Mar 30, 2019
  19. 17/31 sha1-name.c: remove the_repo from interpret_branch_mark()Nguyễn Thái Ngọc Duy, Mar 30, 2019
  20. 18/31 sha1-name.c: add repo_interpret_branch_name()Nguyễn Thái Ngọc Duy, Mar 30, 2019
  21. 19/31 sha1-name.c: remove the_repo from get_oid_oneline()Nguyễn Thái Ngọc Duy, Mar 30, 2019
  22. 20/31 sha1-name.c: remove the_repo from get_describe_name()Nguyễn Thái Ngọc Duy, Mar 30, 2019
  23. 21/31 sha1-name.c: remove the_repo from get_oid_basic()Nguyễn Thái Ngọc Duy, Mar 30, 2019
  24. 22/31 sha1-name.c: remove the_repo from get_oid_1()Nguyễn Thái Ngọc Duy, Mar 30, 2019
  25. 23/31 sha1-name.c: remove the_repo from handle_one_ref()Nguyễn Thái Ngọc Duy, Mar 30, 2019
  26. 24/31 sha1-name.c: remove the_repo from diagnose_invalid_index_path()Nguyễn Thái Ngọc Duy, Mar 30, 2019
  27. 25/31 sha1-name.c: remove the_repo from resolve_relative_path()Nguyễn Thái Ngọc Duy, Mar 30, 2019
  28. 26/31 sha1-name.c: remove the_repo from get_oid_with_context_1()Nguyễn Thái Ngọc Duy, Mar 30, 2019
  29. 27/31 sha1-name.c: add repo_get_oid()Nguyễn Thái Ngọc Duy, Mar 30, 2019
  30. 28/31 submodule-config.c: use repo_get_oid for reading .gitmodulesNguyễn Thái Ngọc Duy, Mar 30, 2019
  31. 29/31 sha1-name.c: remove the_repo from maybe_die_on_misspelt_object_nameNguyễn Thái Ngọc Duy, Mar 30, 2019
  32. 30/31 sha1-name.c: remove the_repo from other get_oid_*Nguyễn Thái Ngọc Duy, Mar 30, 2019
  33. 31/31 sha1-name.c: remove the_repo from get_oid_mb()Nguyễn Thái Ngọc Duy, Mar 30, 2019
  34. 00/32 nd/sha1-name-c-wo-the-repository updatesNguyễn Thái Ngọc Duy, Apr 3, 2019
  35. 01/32 rebase: 'make coccicheck' cleanupNguyễn Thái Ngọc Duy, Apr 3, 2019
  36. SZEDER GáborApr 4, 2019
  37. Duy NguyenApr 5, 2019
  38. SZEDER GáborApr 9, 2019
  39. 02/32 packfile.c: add repo_approximate_object_count()Nguyễn Thái Ngọc Duy, Apr 3, 2019
  40. 03/32 refs.c: add refs_ref_exists()Nguyễn Thái Ngọc Duy, Apr 3, 2019
  41. 04/32 refs.c: add refs_shorten_unambiguous_ref()Nguyễn Thái Ngọc Duy, Apr 3, 2019
  42. 05/32 refs.c: remove the_repo from substitute_branch_name()Nguyễn Thái Ngọc Duy, Apr 3, 2019
  43. 06/32 refs.c: remove the_repo from expand_ref()Nguyễn Thái Ngọc Duy, Apr 3, 2019
  44. 07/32 refs.c: add repo_dwim_ref()Nguyễn Thái Ngọc Duy, Apr 3, 2019
  45. 08/32 refs.c: add repo_dwim_log()Nguyễn Thái Ngọc Duy, Apr 3, 2019
  46. 09/32 refs.c: remove the_repo from read_ref_at()Nguyễn Thái Ngọc Duy, Apr 3, 2019
  47. 10/32 commit.c: add repo_get_commit_tree()Nguyễn Thái Ngọc Duy, Apr 3, 2019
  48. SZEDER GáborApr 4, 2019
  49. Duy NguyenApr 5, 2019
  50. Johannes SchindelinApr 5, 2019
  51. 11/32 sha1-name.c: remove the_repo from sort_ambiguous()Nguyễn Thái Ngọc Duy, Apr 3, 2019
  52. 12/32 sha1-name.c: remove the_repo from find_abbrev_len_packed()Nguyễn Thái Ngọc Duy, Apr 3, 2019
  53. 13/32 sha1-name.c: add repo_find_unique_abbrev_r()Nguyễn Thái Ngọc Duy, Apr 3, 2019
  54. 14/32 sha1-name.c: store and use repo in struct disambiguate_stateNguyễn Thái Ngọc Duy, Apr 3, 2019
  55. 15/32 sha1-name.c: add repo_for_each_abbrev()Nguyễn Thái Ngọc Duy, Apr 3, 2019
  56. 16/32 sha1-name.c: remove the_repo from get_short_oid()Nguyễn Thái Ngọc Duy, Apr 3, 2019
  57. 17/32 sha1-name.c: remove the_repo from interpret_nth_prior_checkout()Nguyễn Thái Ngọc Duy, Apr 3, 2019
  58. 18/32 sha1-name.c: remove the_repo from interpret_branch_mark()Nguyễn Thái Ngọc Duy, Apr 3, 2019
  59. 19/32 sha1-name.c: add repo_interpret_branch_name()Nguyễn Thái Ngọc Duy, Apr 3, 2019
  60. 20/32 sha1-name.c: remove the_repo from get_oid_oneline()Nguyễn Thái Ngọc Duy, Apr 3, 2019
  61. 21/32 sha1-name.c: remove the_repo from get_describe_name()Nguyễn Thái Ngọc Duy, Apr 3, 2019
  62. 22/32 sha1-name.c: remove the_repo from get_oid_basic()Nguyễn Thái Ngọc Duy, Apr 3, 2019
  63. 23/32 sha1-name.c: remove the_repo from get_oid_1()Nguyễn Thái Ngọc Duy, Apr 3, 2019
  64. 24/32 sha1-name.c: remove the_repo from handle_one_ref()Nguyễn Thái Ngọc Duy, Apr 3, 2019
  65. 25/32 sha1-name.c: remove the_repo from diagnose_invalid_index_path()Nguyễn Thái Ngọc Duy, Apr 3, 2019
  66. 26/32 sha1-name.c: remove the_repo from resolve_relative_path()Nguyễn Thái Ngọc Duy, Apr 3, 2019
  67. 27/32 sha1-name.c: remove the_repo from get_oid_with_context_1()Nguyễn Thái Ngọc Duy, Apr 3, 2019
  68. 28/32 sha1-name.c: add repo_get_oid()Nguyễn Thái Ngọc Duy, Apr 3, 2019
  69. 29/32 submodule-config.c: use repo_get_oid for reading .gitmodulesNguyễn Thái Ngọc Duy, Apr 3, 2019
  70. 30/32 sha1-name.c: remove the_repo from maybe_die_on_misspelt_object_nameNguyễn Thái Ngọc Duy, Apr 3, 2019
  71. 31/32 sha1-name.c: remove the_repo from other get_oid_*Nguyễn Thái Ngọc Duy, Apr 3, 2019
  72. 32/32 sha1-name.c: remove the_repo from get_oid_mb()Nguyễn Thái Ngọc Duy, Apr 3, 2019
  73. 00/33 nd/sha1-name-c-wo-the-repository updatesNguyễn Thái Ngọc Duy, Apr 6, 2019
  74. 01/33 builtin rebase: use FREE_AND_NULLNguyễn Thái Ngọc Duy, Apr 6, 2019
  75. 02/33 builtin rebase: use oideq()Nguyễn Thái Ngọc Duy, Apr 6, 2019
  76. 03/33 packfile.c: add repo_approximate_object_count()Nguyễn Thái Ngọc Duy, Apr 6, 2019
  77. 04/33 refs.c: add refs_ref_exists()Nguyễn Thái Ngọc Duy, Apr 6, 2019
  78. 05/33 refs.c: add refs_shorten_unambiguous_ref()Nguyễn Thái Ngọc Duy, Apr 6, 2019
  79. 06/33 refs.c: remove the_repo from substitute_branch_name()Nguyễn Thái Ngọc Duy, Apr 6, 2019
  80. 07/33 refs.c: remove the_repo from expand_ref()Nguyễn Thái Ngọc Duy, Apr 6, 2019
  81. 08/33 refs.c: add repo_dwim_ref()Nguyễn Thái Ngọc Duy, Apr 6, 2019
  82. 09/33 refs.c: add repo_dwim_log()Nguyễn Thái Ngọc Duy, Apr 6, 2019
  83. 10/33 refs.c: remove the_repo from read_ref_at()Nguyễn Thái Ngọc Duy, Apr 6, 2019
  84. 11/33 commit.c: add repo_get_commit_tree()Nguyễn Thái Ngọc Duy, Apr 6, 2019
  85. 12/33 sha1-name.c: remove the_repo from sort_ambiguous()Nguyễn Thái Ngọc Duy, Apr 6, 2019
  86. 13/33 sha1-name.c: remove the_repo from find_abbrev_len_packed()Nguyễn Thái Ngọc Duy, Apr 6, 2019
  87. 14/33 sha1-name.c: add repo_find_unique_abbrev_r()Nguyễn Thái Ngọc Duy, Apr 6, 2019
  88. 15/33 sha1-name.c: store and use repo in struct disambiguate_stateNguyễn Thái Ngọc Duy, Apr 6, 2019
  89. 16/33 sha1-name.c: add repo_for_each_abbrev()Nguyễn Thái Ngọc Duy, Apr 6, 2019
  90. 17/33 sha1-name.c: remove the_repo from get_short_oid()Nguyễn Thái Ngọc Duy, Apr 6, 2019
  91. 18/33 sha1-name.c: remove the_repo from interpret_nth_prior_checkout()Nguyễn Thái Ngọc Duy, Apr 6, 2019
  92. 19/33 sha1-name.c: remove the_repo from interpret_branch_mark()Nguyễn Thái Ngọc Duy, Apr 6, 2019
  93. 20/33 sha1-name.c: add repo_interpret_branch_name()Nguyễn Thái Ngọc Duy, Apr 6, 2019
  94. 21/33 sha1-name.c: remove the_repo from get_oid_oneline()Nguyễn Thái Ngọc Duy, Apr 6, 2019
  95. 22/33 sha1-name.c: remove the_repo from get_describe_name()Nguyễn Thái Ngọc Duy, Apr 6, 2019
  96. 23/33 sha1-name.c: remove the_repo from get_oid_basic()Nguyễn Thái Ngọc Duy, Apr 6, 2019
  97. 24/33 sha1-name.c: remove the_repo from get_oid_1()Nguyễn Thái Ngọc Duy, Apr 6, 2019
  98. 25/33 sha1-name.c: remove the_repo from handle_one_ref()Nguyễn Thái Ngọc Duy, Apr 6, 2019
  99. 26/33 sha1-name.c: remove the_repo from diagnose_invalid_index_path()Nguyễn Thái Ngọc Duy, Apr 6, 2019
  100. 27/33 sha1-name.c: remove the_repo from resolve_relative_path()Nguyễn Thái Ngọc Duy, Apr 6, 2019
  101. 28/33 sha1-name.c: remove the_repo from get_oid_with_context_1()Nguyễn Thái Ngọc Duy, Apr 6, 2019
  102. 29/33 sha1-name.c: add repo_get_oid()Nguyễn Thái Ngọc Duy, Apr 6, 2019
  103. 30/33 submodule-config.c: use repo_get_oid for reading .gitmodulesNguyễn Thái Ngọc Duy, Apr 6, 2019
  104. 31/33 sha1-name.c: remove the_repo from maybe_die_on_misspelt_object_nameNguyễn Thái Ngọc Duy, Apr 6, 2019
  105. 32/33 sha1-name.c: remove the_repo from other get_oid_*Nguyễn Thái Ngọc Duy, Apr 6, 2019
  106. 33/33 sha1-name.c: remove the_repo from get_oid_mb()Nguyễn Thái Ngọc Duy, Apr 6, 2019
  107. Johannes SchindelinApr 10, 2019
  108. Duy NguyenApr 11, 2019
  109. Johannes SchindelinApr 11, 2019
  110. SZEDER GáborApr 11, 2019
  111. SZEDER GáborApr 11, 2019
  112. SZEDER GáborApr 12, 2019
  113. Johannes SchindelinApr 12, 2019
  114. 11/33 commit.c: add repo_get_commit_tree()Nguyễn Thái Ngọc Duy, Apr 13, 2019
  115. SZEDER GáborApr 13, 2019
  116. Johannes SchindelinApr 15, 2019
  117. SZEDER GáborApr 13, 2019
  118. Duy NguyenApr 13, 2019
  119. 00/34 nd/sha1-name-c-wo-the-repository updatesNguyễn Thái Ngọc Duy, Apr 16, 2019
  120. 01/34 builtin rebase: use FREE_AND_NULLNguyễn Thái Ngọc Duy, Apr 16, 2019
  121. 02/34 builtin rebase: use oideq()Nguyễn Thái Ngọc Duy, Apr 16, 2019
  122. 03/34 packfile.c: add repo_approximate_object_count()Nguyễn Thái Ngọc Duy, Apr 16, 2019
  123. 04/34 refs.c: add refs_ref_exists()Nguyễn Thái Ngọc Duy, Apr 16, 2019
  124. 05/34 refs.c: add refs_shorten_unambiguous_ref()Nguyễn Thái Ngọc Duy, Apr 16, 2019
  125. 06/34 refs.c: remove the_repo from substitute_branch_name()Nguyễn Thái Ngọc Duy, Apr 16, 2019
  126. 07/34 refs.c: remove the_repo from expand_ref()Nguyễn Thái Ngọc Duy, Apr 16, 2019
  127. 08/34 refs.c: add repo_dwim_ref()Nguyễn Thái Ngọc Duy, Apr 16, 2019
  128. 09/34 refs.c: add repo_dwim_log()Nguyễn Thái Ngọc Duy, Apr 16, 2019
  129. 10/34 refs.c: remove the_repo from read_ref_at()Nguyễn Thái Ngọc Duy, Apr 16, 2019
  130. 11/34 commit.cocci: refactor code, avoid double rewriteNguyễn Thái Ngọc Duy, Apr 16, 2019
  131. 12/34 commit.c: add repo_get_commit_tree()Nguyễn Thái Ngọc Duy, Apr 16, 2019
  132. 13/34 sha1-name.c: remove the_repo from sort_ambiguous()Nguyễn Thái Ngọc Duy, Apr 16, 2019
  133. 14/34 sha1-name.c: remove the_repo from find_abbrev_len_packed()Nguyễn Thái Ngọc Duy, Apr 16, 2019
  134. 15/34 sha1-name.c: add repo_find_unique_abbrev_r()Nguyễn Thái Ngọc Duy, Apr 16, 2019
  135. 16/34 sha1-name.c: store and use repo in struct disambiguate_stateNguyễn Thái Ngọc Duy, Apr 16, 2019
  136. 17/34 sha1-name.c: add repo_for_each_abbrev()Nguyễn Thái Ngọc Duy, Apr 16, 2019
  137. 18/34 sha1-name.c: remove the_repo from get_short_oid()Nguyễn Thái Ngọc Duy, Apr 16, 2019
  138. 19/34 sha1-name.c: remove the_repo from interpret_nth_prior_checkout()Nguyễn Thái Ngọc Duy, Apr 16, 2019
  139. 20/34 sha1-name.c: remove the_repo from interpret_branch_mark()Nguyễn Thái Ngọc Duy, Apr 16, 2019
  140. 21/34 sha1-name.c: add repo_interpret_branch_name()Nguyễn Thái Ngọc Duy, Apr 16, 2019
  141. 22/34 sha1-name.c: remove the_repo from get_oid_oneline()Nguyễn Thái Ngọc Duy, Apr 16, 2019
  142. 23/34 sha1-name.c: remove the_repo from get_describe_name()Nguyễn Thái Ngọc Duy, Apr 16, 2019
  143. 24/34 sha1-name.c: remove the_repo from get_oid_basic()Nguyễn Thái Ngọc Duy, Apr 16, 2019
  144. 25/34 sha1-name.c: remove the_repo from get_oid_1()Nguyễn Thái Ngọc Duy, Apr 16, 2019
  145. 26/34 sha1-name.c: remove the_repo from handle_one_ref()Nguyễn Thái Ngọc Duy, Apr 16, 2019
  146. 27/34 sha1-name.c: remove the_repo from diagnose_invalid_index_path()Nguyễn Thái Ngọc Duy, Apr 16, 2019
  147. 28/34 sha1-name.c: remove the_repo from resolve_relative_path()Nguyễn Thái Ngọc Duy, Apr 16, 2019
  148. 29/34 sha1-name.c: remove the_repo from get_oid_with_context_1()Nguyễn Thái Ngọc Duy, Apr 16, 2019
  149. 30/34 sha1-name.c: add repo_get_oid()Nguyễn Thái Ngọc Duy, Apr 16, 2019
  150. 31/34 submodule-config.c: use repo_get_oid for reading .gitmodulesNguyễn Thái Ngọc Duy, Apr 16, 2019
  151. 32/34 sha1-name.c: remove the_repo from maybe_die_on_misspelt_object_nameNguyễn Thái Ngọc Duy, Apr 16, 2019
  152. 33/34 sha1-name.c: remove the_repo from other get_oid_*Nguyễn Thái Ngọc Duy, Apr 16, 2019
  153. 34/34 sha1-name.c: remove the_repo from get_oid_mb()Nguyễn Thái Ngọc Duy, Apr 16, 2019

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.