Merge branch 'ds/for-each-repo-w-worktree' into jch

"git for-each-repo" started from a secondary worktree did not work
as expected, which has been corrected.

* ds/for-each-repo-w-worktree:
  for-each-repo: simplify passing of parameters
  for-each-repo: work correctly in a worktree
  run-command: extract sanitize_repo_env helper
  for-each-repo: test outside of repo context
This commit is contained in:
Junio C Hamano
2026-03-10 14:23:39 -07:00
4 changed files with 77 additions and 24 deletions

View File

@@ -1971,7 +1971,7 @@ int run_auto_maintenance(int quiet)
return run_command(&maint);
}
void prepare_other_repo_env(struct strvec *env, const char *new_git_dir)
void sanitize_repo_env(struct strvec *env)
{
const char * const *var;
@@ -1980,6 +1980,11 @@ void prepare_other_repo_env(struct strvec *env, const char *new_git_dir)
strcmp(*var, CONFIG_COUNT_ENVIRONMENT))
strvec_push(env, *var);
}
}
void prepare_other_repo_env(struct strvec *env, const char *new_git_dir)
{
sanitize_repo_env(env);
strvec_pushf(env, "%s=%s", GIT_DIR_ENVIRONMENT, new_git_dir);
}