On Sun, Dec 8, 2019 at 10:51 PM Duy Nguyen <xxxxxx@gmail.com> wrote:
 
For programs like Git, it takes $GIT_DIR and needs to pass it down to
all subprocess. The thing is this variable can contain relative path,
so if you "cd" somewhere in the current process, then you need to
adjust $GIT_DIR too or subprocess will fail to find the right ".git"
directory. And it's less error prone to adjust the variable with
setenv whenever you chdir instead of waiting until you spawn a new
subprocess.

I didn't know that.  But it would be equally good to capture the environment as an alist and adjust the alist (far easier and safer than adjusting the real environment) until you pass it to your subprocess.

Still better would be to do the above and make $GIT_DIR absolute right away.



John Cowan          http://vrici.lojban.org/~cowan        xxxxxx@ccil.org
O beautiful for patriot's dream that sees beyond the years
Thine alabaster cities gleam undimmed by human tears!
America! America!  God mend thine every flaw,
Confirm thy soul in self-control, thy liberty in law!
        --one of the verses not usually taught in U.S. schools
 
--
Duy