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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxx/
     +	 */
      	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@xxxxxxxxxx>
     
      ## 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




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux