On 11/25/2021 3:39 AM, Elijah Newren via GitGitGadget wrote: > From: Elijah Newren <newren@xxxxxxxxx> > @@ -866,6 +866,8 @@ int cmd_main(int argc, const char **argv) > > trace_command_performance(argv); > > + startup_info->original_cwd = xgetcwd(); > + I see this initial assignment in cmd_main()... > +static void setup_original_cwd(void) > +{ > + struct strbuf tmp = STRBUF_INIT; > + const char *worktree = NULL; > + int offset = -1; > + > + /* > + * startup_info->original_cwd wass set early on in cmd_main(), unless > + * we're an auxiliary tool like git-remote-http or test-tool. > + */ > + if (!startup_info->original_cwd) > + return; ...which is assumed to be run before this method was called... > @@ -1330,6 +1378,7 @@ const char *setup_git_directory_gently(int *nongit_ok) > setenv(GIT_PREFIX_ENVIRONMENT, "", 1); > } > > + setup_original_cwd(); ...here in setup_git_directory_gently(). Why do we need that assignment in cmd_main()? Could we instead let setup_original_cwd() do the initial assignment? Or is it possible that a chdir has happened already before this point? Thanks, -Stolee