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

[PATCH v3 0/8] In grep, no adding submodule ODB as alternates

From
JTJonathan Tan <jonathantanmy@google.com>
Date
Aug 16, 2021, 21:09 UTC
Message-ID
<cover.1629148153.git.jonathantanmy@google.com>
In-Reply-To
<cover.1628618950.git.jonathantanmy@google.com>
Thanks for reviewing, everyone. Here are the requested changes.
Jonathan Tan (8):
  submodule: lazily add submodule ODBs as alternates
  grep: use submodule-ODB-as-alternate lazy-addition
  grep: typesafe versions of grep_source_init
  grep: read submodule entry with explicit repo
  grep: allocate subrepos on heap
  grep: add repository to OID grep sources
  submodule-config: pass repo upon blob config read
  t7814: show lack of alternate ODB-adding
 builtin/grep.c                     | 64 +++++++++++++++++++-----------
 config.c                           | 20 ++++++----
 config.h                           |  3 ++
 grep.c                             | 51 +++++++++++++++---------
 grep.h                             | 22 ++++++++--
 object-file.c                      |  5 +++
 submodule-config.c                 |  5 ++-
 submodule.c                        | 25 +++++++++++-
 submodule.h                        |  8 ++++
 t/README                           | 10 +++++
 t/t7814-grep-recurse-submodules.sh |  3 ++
 11 files changed, 161 insertions(+), 55 deletions(-)
Range-diff against v2:
1:  5994a517e8 = 1:  5994a517e8 submodule: lazily add submodule ODBs as alternates
2:  31e9b914c4 = 2:  31e9b914c4 grep: use submodule-ODB-as-alternate lazy-addition
3:  aa3f1f3c89 = 3:  aa3f1f3c89 grep: typesafe versions of grep_source_init
4:  050deacfb7 = 4:  050deacfb7 grep: read submodule entry with explicit repo
5:  3f24815224 ! 5:  7d1eeac4b5 grep: allocate subrepos on heap
    @@ builtin/grep.c: static void work_done(struct work_item *w)
     +		repo_clear(repos_to_free[i]);
     +		free(repos_to_free[i]);
     +	}
    -+	free(repos_to_free);
    ++	FREE_AND_NULL(repos_to_free);
     +	repos_to_free_nr = 0;
     +	repos_to_free_alloc = 0;
     +}
6:  50c69a988b ! 6:  f362fc278c grep: add repository to OID grep sources
    @@ grep.h: struct grep_opt {
     +
     +	/*
     +	 * NEEDSWORK: See if we can remove this field, because the repository
    -+	 * should probably be per-source, not per-repo. This is potentially the
    -+	 * cause of at least one bug - "git grep" ignoring the textconv
    -+	 * attributes from submodules. See [1] for more information.
    ++	 * should probably be per-source. That is, grep.c functions using this
    ++	 * field should probably start using "repo" in "struct grep_source"
    ++	 * instead.
    ++	 *
    ++	 * This is potentially the cause of at least one bug - "git grep"
    ++	 * ignoring the textconv attributes from submodules. See [1] for more
    ++	 * information.
     +	 * [1] https://lore.kernel.org/git/CAHd-oW5iEQarYVxEXoTG-ua2zdoybTrSjCBKtO0YT292fm0NQQ@mail.gmail.com/
     +	 */
      	struct repository *repo;
7:  94db10a4e5 ! 7:  8b86618531 submodule-config: pass repo upon blob config read
    @@ Commit message
         submodule's ODB as an alternate and then reading an object from
         the_repository.
     
    +    This makes the "grep --recurse-submodules with submodules without
    +    .gitmodules in the working tree" test in t7814 work when
    +    GIT_TEST_FATAL_REGISTER_SUBMODULE_ODB is true.
    +
         Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
     
      ## config.c ##
    @@ config.c: int git_config_from_blob_oid(config_fn_t fn,
      				    const char *name,
      				    void *data)
      {
    -@@ config.c: static int git_config_from_blob_ref(config_fn_t fn,
    + 	struct object_id oid;
      
    - 	if (get_oid(name, &oid) < 0)
    +-	if (get_oid(name, &oid) < 0)
    ++	if (repo_get_oid(repo, name, &oid) < 0)
      		return error(_("unable to resolve config blob '%s'"), name);
     -	return git_config_from_blob_oid(fn, name, &oid, data);
     +	return git_config_from_blob_oid(fn, name, repo, &oid, data);
8:  4a51fcfb77 = 8:  4b3176f99e t7814: show lack of alternate ODB-adding
-- 
2.33.0.rc1.237.g0d66db33f3-goog
Previous: Matheus Tavares BernardinoNext: Jonathan Tan
Message 56 of 71 in “In grep, no adding submodule ODB as alternates”
  1. 0/7 In grep, no adding submodule ODB as alternatesJonathan Tan, Aug 10, 2021
  2. 4/7 grep: read submodule entry with explicit repoJonathan Tan, Aug 10, 2021
  3. Emily ShafferAug 11, 2021
  4. Jonathan TanAug 13, 2021
  5. 3/7 grep: typesafe versions of grep_source_initJonathan Tan, Aug 10, 2021
  6. Junio C HamanoAug 10, 2021
  7. Emily ShafferAug 11, 2021
  8. Ramsay JonesAug 11, 2021
  9. Jonathan TanAug 13, 2021
  10. Matheus Tavares BernardinoAug 11, 2021
  11. Junio C HamanoAug 12, 2021
  12. Jonathan TanAug 13, 2021
  13. 2/7 grep: use submodule-ODB-as-alternate lazy-additionJonathan Tan, Aug 10, 2021
  14. Emily ShafferAug 11, 2021
  15. Jonathan TanAug 13, 2021
  16. 1/7 submodule: lazily add submodule ODBs as alternatesJonathan Tan, Aug 10, 2021
  17. Junio C HamanoAug 10, 2021
  18. Jonathan TanAug 13, 2021
  19. Emily ShafferAug 11, 2021
  20. Jonathan TanAug 13, 2021
  21. 5/7 grep: allocate subrepos on heapJonathan Tan, Aug 10, 2021
  22. Emily ShafferAug 11, 2021
  23. Jonathan TanAug 13, 2021
  24. 6/7 grep: add repository to OID grep sourcesJonathan Tan, Aug 10, 2021
  25. Emily ShafferAug 11, 2021
  26. Jonathan TanAug 13, 2021
  27. Matheus Tavares BernardinoAug 11, 2021
  28. Jonathan TanAug 13, 2021
  29. 7/7 t7814: show lack of alternate ODB-addingJonathan Tan, Aug 10, 2021
  30. Emily ShafferAug 11, 2021
  31. Matheus Tavares BernardinoAug 11, 2021
  32. Jonathan TanAug 13, 2021
  33. Emily ShafferAug 11, 2021
  34. Josh SteadmonAug 11, 2021
  35. 0/8 In grep, no adding submodule ODB as alternatesJonathan Tan, Aug 13, 2021
  36. 2/8 grep: use submodule-ODB-as-alternate lazy-additionJonathan Tan, Aug 13, 2021
  37. 1/8 submodule: lazily add submodule ODBs as alternatesJonathan Tan, Aug 13, 2021
  38. 3/8 grep: typesafe versions of grep_source_initJonathan Tan, Aug 13, 2021
  39. Matheus Tavares BernardinoAug 16, 2021
  40. 4/8 grep: read submodule entry with explicit repoJonathan Tan, Aug 13, 2021
  41. 5/8 grep: allocate subrepos on heapJonathan Tan, Aug 13, 2021
  42. Junio C HamanoAug 13, 2021
  43. Jonathan TanAug 16, 2021
  44. 6/8 grep: add repository to OID grep sourcesJonathan Tan, Aug 13, 2021
  45. Matheus Tavares BernardinoAug 16, 2021
  46. Jonathan TanAug 16, 2021
  47. 7/8 submodule-config: pass repo upon blob config readJonathan Tan, Aug 13, 2021
  48. Matheus Tavares BernardinoAug 16, 2021
  49. Matheus Tavares BernardinoAug 16, 2021
  50. Jonathan TanAug 16, 2021
  51. Matheus Tavares BernardinoAug 16, 2021
  52. Jonathan TanAug 16, 2021
  53. Jonathan TanAug 16, 2021
  54. 8/8 t7814: show lack of alternate ODB-addingJonathan Tan, Aug 13, 2021
  55. Matheus Tavares BernardinoAug 16, 2021
  56. 0/8 In grep, no adding submodule ODB as alternatesJonathan Tan, Aug 16, 2021
  57. 1/8 submodule: lazily add submodule ODBs as alternatesJonathan Tan, Aug 16, 2021
  58. 2/8 grep: use submodule-ODB-as-alternate lazy-additionJonathan Tan, Aug 16, 2021
  59. 3/8 grep: typesafe versions of grep_source_initJonathan Tan, Aug 16, 2021
  60. 4/8 grep: read submodule entry with explicit repoJonathan Tan, Aug 16, 2021
  61. 5/8 grep: allocate subrepos on heapJonathan Tan, Aug 16, 2021
  62. 6/8 grep: add repository to OID grep sourcesJonathan Tan, Aug 16, 2021
  63. Ævar Arnfjörð BjarmasonSep 27, 2021
  64. Matheus TavaresSep 27, 2021
  65. Ævar Arnfjörð BjarmasonSep 27, 2021
  66. 7/8 submodule-config: pass repo upon blob config readJonathan Tan, Aug 16, 2021
  67. 8/8 t7814: show lack of alternate ODB-addingJonathan Tan, Aug 16, 2021
  68. Matheus Tavares BernardinoAug 17, 2021
  69. Junio C HamanoSep 8, 2021
  70. Matheus Tavares BernardinoSep 8, 2021
  71. Junio C HamanoSep 8, 2021

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.