Brandon Williams <bmwill@xxxxxxxxxx> writes: > ... I was being cautious with this patch since git didn't currently > read GIT_PREFIX. Ahh, I forgot about that. Processes we spawn do expect GIT_PREFIX to tell them where the original $cwd was and they also do expect that "git" invoked by them would not be affected by GIT_PREFIX environment variable. So we cannot change that now. If you recurse into sub-sub module, it is likely that you would want to update the TOPLEVEL_PREFIX relative to that sub-sub module you are descending into. That probably also means that processes we spawn now need to also pay attention to TOPLEVEL_PREFIX in addition to GIT_PREFIX, and we should NOT re-export what we got from TOPLEVEL_PREFIX to GIT_PREFIX. I.e. if a "git" process started from src/ subdirectory of the superproject that goes into module/sub1/ submodule, top-level prefix may export ../src/ to point at the original location, but the process that is running in the submodule will be running at the root level of the submodule working tree, so its prefix should be NULL or "", no? Adjusting pathspec and other file references on the caller's side, instead of exporting toplevel-prefix to have them adjusted by the callee, started to smell more and more like an easier/more correct approach to me, but perhaps I haven't thought things deeply enough. I dunno.