Subject: [PATCH v4 0/5] First steps towards partial clone submodules

From: Jonathan Tan <[email-masked]>
Date: Thu, 17 Jun 2021 10:13:21 -0700

Quoting from [1]:

> I'm happy with Jonathan and Peff's responses on patch 3; as I
> mentioned above I just didn't understand the original code before
> Jonathan's changes.  (Perhaps some comments could be added to clarify
> that code area, but again that's clarifying the code that existed
> before Jonathan's patch so it doesn't need to be part of his series.)
> So that only leaves my nitpicks on patches 1 & 4; otherwise the series
> looks good to me.

I've addressed Elijah's comments on patches 1 and 4.

[1] https://lore.kernel.org/git/CABPp-BFD5=98C0+WnfK=[email-masked]/

Jonathan Tan (5):
  repository: move global r_f_p_c to repo struct
  promisor-remote: support per-repository config
  submodule: refrain from filtering GIT_CONFIG_COUNT
  run-command: refactor subprocess env preparation
  promisor-remote: teach lazy-fetch in any repo

 Makefile                      |   1 +
 object-file.c                 |   7 +--
 promisor-remote.c             | 108 ++++++++++++++++++----------------
 promisor-remote.h             |  28 ++++++---
 repository.c                  |  10 ++++
 repository.h                  |   5 ++
 run-command.c                 |  12 ++++
 run-command.h                 |  10 ++++
 setup.c                       |  17 ++++--
 submodule.c                   |  17 +-----
 t/helper/test-partial-clone.c |  43 ++++++++++++++
 t/helper/test-tool.c          |   1 +
 t/helper/test-tool.h          |   1 +
 t/t0410-partial-clone.sh      |  23 ++++++++
 14 files changed, 199 insertions(+), 84 deletions(-)
 create mode 100644 t/helper/test-partial-clone.c

Range-diff against v3:
1:  e8e6a95951 ! 1:  0bd009597d repository: move global r_f_p_c to repo struct
    @@ repository.c: int repo_init(struct repository *repo,
      
      	repo_set_hash_algo(repo, format.hash_algo);
      
    ++	/* take ownership of format.partial_clone */
     +	repo->repository_format_partial_clone = format.partial_clone;
     +	format.partial_clone = NULL;
     +
    @@ setup.c: int discover_git_directory(struct strbuf *commondir,
      		return -1;
      	}
      
    ++	/* take ownership of candidate.partial_clone */
     +	the_repository->repository_format_partial_clone =
     +		candidate.partial_clone;
     +	candidate.partial_clone = NULL;
    @@ setup.c: const char *setup_git_directory_gently(int *nongit_ok)
     -		if (startup_info->have_repository)
     +		if (startup_info->have_repository) {
      			repo_set_hash_algo(the_repository, repo_fmt.hash_algo);
    ++			/* take ownership of repo_fmt.partial_clone */
     +			the_repository->repository_format_partial_clone =
     +				repo_fmt.partial_clone;
     +			repo_fmt.partial_clone = NULL;
    @@ setup.c: const char *setup_git_directory_gently(int *nongit_ok)
      	}
      	/*
      	 * Since precompose_string_if_needed() needs to look at
    -@@ setup.c: const char *setup_git_directory_gently(int *nongit_ok)
    - 		setenv(GIT_PREFIX_ENVIRONMENT, "", 1);
    - 	}
    - 
    --
    - 	strbuf_release(&dir);
    - 	strbuf_release(&gitdir);
    - 	clear_repository_format(&repo_fmt);
     @@ setup.c: void check_repository_format(struct repository_format *fmt)
      	check_repository_format_gently(get_git_dir(), fmt, NULL);
      	startup_info->have_repository = 1;
2:  07eb0a0f39 = 2:  8a478b46bf promisor-remote: support per-repository config
3:  004ac92e9b = 3:  78b4108ae1 submodule: refrain from filtering GIT_CONFIG_COUNT
4:  ce0454f442 ! 4:  1778cbf878 run-command: refactor subprocess env preparation
    @@ run-command.h: int run_processes_parallel_tr2(int n, get_next_task_fn, start_fai
     +/**
     + * Convenience function which prepares env_array for a command to be run in a
     + * new repo. This adds all GIT_* environment variables to env_array with the
    -+ * exception of GIT_CONFIG_PARAMETERS (which cause the corresponding
    -+ * environment variables to be unset in the subprocess) and adds an environment
    -+ * variable pointing to new_git_dir. See local_repo_env in cache.h for more
    -+ * information.
    ++ * exception of GIT_CONFIG_PARAMETERS and GIT_CONFIG_COUNT (which cause the
    ++ * corresponding environment variables to be unset in the subprocess) and adds
    ++ * an environment variable pointing to new_git_dir. See local_repo_env in
    ++ * cache.h for more information.
     + */
     +void prepare_other_repo_env(struct strvec *env_array, const char *new_git_dir);
     +
5:  a3278d61f0 = 5:  dbba426b6a promisor-remote: teach lazy-fetch in any repo
-- 
2.32.0.272.g935e593368-goog