submodules: ensure clean environment when operating in a submodule oblomov/clear-submodules
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Mon, 22 Feb 2010 21:18:53 +0000 (22:18 +0100)
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Tue, 23 Feb 2010 08:17:50 +0000 (09:17 +0100)
commita1d033b356ca34eaea3863f70b0a307bb34d6d60
tree36727941d8ca590a166c68e79fbed91b789a3aa8
parent105efa86d2d7c0514e3d4b7b9d0e389f96916c04
submodules: ensure clean environment when operating in a submodule

git-submodule used to take care of clearing GIT_DIR whenever it operated
on a submodule index or configuration, but forgot to unset GIT_WORK_TREE
or other repo-local variables. This which would lead to failures e.g.
when GIT_WORK_TREE was set.

This only happened in very unusual contexts such as operating on the
main worktree from outside of it, but since "git-gui: set GIT_DIR and
GIT_WORK_TREE after setup" (a9fa11fe5bd5978bb) such failures could also
be provoked by invoking an external tool such as "git submodule update"
from the Git Gui in a standard setup.

Solve by using the newly introduced clear_local_git_env() shell function
to ensure that all repo-local environment variables are unset.

Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
git-submodule.sh