@ -222,7 +222,7 @@ cmd_add()
module_clone "$path" "$realrepo" "$reference" || exit
module_clone "$path" "$realrepo" "$reference" || exit
(
(
unset GIT_DIR
clear_local_git_env
cd "$path" &&
cd "$path" &&
# ash fails to wordsplit ${branch:+-b "$branch"...}
# ash fails to wordsplit ${branch:+-b "$branch"...}
case "$branch" in
case "$branch" in
@ -278,7 +278,7 @@ cmd_foreach()
name=$(module_name "$path")
name=$(module_name "$path")
(
(
prefix="$prefix$path/"
prefix="$prefix$path/"
unset GIT_DIR
clear_local_git_env
cd "$path" &&
cd "$path" &&
eval "$@" &&
eval "$@" &&
if test -n "$recursive"
if test -n "$recursive"
@ -434,7 +434,7 @@ cmd_update()
module_clone "$path" "$url" "$reference"|| exit
module_clone "$path" "$url" "$reference"|| exit
subsha1=
subsha1=
else
else
subsha1=$(unset GIT_DIR; cd "$path" &&
subsha1=$(clear_local_git_env; cd "$path" &&
git rev-parse --verify HEAD) ||
git rev-parse --verify HEAD) ||
die "Unable to find current revision in submodule path '$path'"
die "Unable to find current revision in submodule path '$path'"
fi
fi
@ -454,7 +454,7 @@ cmd_update()
if test -z "$nofetch"
if test -z "$nofetch"
then
then
(unset GIT_DIR; cd "$path" &&
(clear_local_git_env; cd "$path" &&
git-fetch) ||
git-fetch) ||
die "Unable to fetch in submodule path '$path'"
die "Unable to fetch in submodule path '$path'"
fi
fi
@ -477,14 +477,14 @@ cmd_update()
;;
;;
esac
esac
(unset GIT_DIR; cd "$path" && $command "$sha1") ||
(clear_local_git_env; cd "$path" && $command "$sha1") ||
die "Unable to $action '$sha1' in submodule path '$path'"
die "Unable to $action '$sha1' in submodule path '$path'"
say "Submodule path '$path': $msg '$sha1'"
say "Submodule path '$path': $msg '$sha1'"
fi
fi
if test -n "$recursive"
if test -n "$recursive"
then
then
(unset GIT_DIR; cd "$path" && cmd_update $orig_args) ||
(clear_local_git_env; cd "$path" && cmd_update $orig_args) ||
die "Failed to recurse into submodule path '$path'"
die "Failed to recurse into submodule path '$path'"
fi
fi
done
done
@ -492,7 +492,7 @@ cmd_update()
set_name_rev () {
set_name_rev () {
revname=$( (
revname=$( (
unset GIT_DIR
clear_local_git_env
cd "$1" && {
cd "$1" && {
git describe "$2" 2>/dev/null ||
git describe "$2" 2>/dev/null ||
git describe --tags "$2" 2>/dev/null ||
git describe --tags "$2" 2>/dev/null ||
@ -757,7 +757,7 @@ cmd_status()
else
else
if test -z "$cached"
if test -z "$cached"
then
then
sha1=$(unset GIT_DIR; cd "$path" && git rev-parse --verify HEAD)
sha1=$(clear_local_git_env; cd "$path" && git rev-parse --verify HEAD)
set_name_rev "$path" "$sha1"
set_name_rev "$path" "$sha1"
fi
fi
say "+$sha1 $displaypath$revname"
say "+$sha1 $displaypath$revname"
@ -767,7 +767,7 @@ cmd_status()
then
then
(
(
prefix="$displaypath/"
prefix="$displaypath/"
unset GIT_DIR
clear_local_git_env
cd "$path" &&
cd "$path" &&
cmd_status $orig_args
cmd_status $orig_args
) ||
) ||
@ -818,7 +818,7 @@ cmd_sync()
if test -e "$path"/.git
if test -e "$path"/.git
then
then
(
(
unset GIT_DIR
clear_local_git_env
cd "$path"
cd "$path"
remote=$(get_default_remote)
remote=$(get_default_remote)
say "Synchronizing submodule url for '$name'"
say "Synchronizing submodule url for '$name'"