summaryrefslogtreecommitdiff
path: root/git-submodule.sh
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2012-07-27 21:13:46 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2012-07-27 21:13:46 -0700
commita64fe6c1d5949492857e1a5ad14d60175dd484fa (patch)
tree7ead9fa752f3eba3caa799866f37e1a468d2a2bd /git-submodule.sh
parentMerge branch 'jk/maint-checkout-orphan-check-fix' (diff)
parentgit-submodule: work with GIT_DIR/GIT_WORK_TREE (diff)
downloadtgif-a64fe6c1d5949492857e1a5ad14d60175dd484fa.tar.xz
Merge branch 'dg/submodule-in-dismembered-working-tree'
In a superproject that has repository outside of its working tree, "git submodule add" failed to clone a new submodule, as GIT_DIR and GIT_WORK_TREE environment variables necessary to work in such a superproject interfered with access to the submodule repository. * dg/submodule-in-dismembered-working-tree: git-submodule: work with GIT_DIR/GIT_WORK_TREE
Diffstat (limited to 'git-submodule.sh')
-rwxr-xr-xgit-submodule.sh7
1 files changed, 5 insertions, 2 deletions
diff --git a/git-submodule.sh b/git-submodule.sh
index dba4d39e1f..9210f3af56 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -181,8 +181,11 @@ module_clone()
rm -f "$gitdir/index"
else
mkdir -p "$gitdir_base"
- git clone $quiet -n ${reference:+"$reference"} \
- --separate-git-dir "$gitdir" "$url" "$sm_path" ||
+ (
+ clear_local_git_env
+ git clone $quiet -n ${reference:+"$reference"} \
+ --separate-git-dir "$gitdir" "$url" "$sm_path"
+ ) ||
die "$(eval_gettext "Clone of '\$url' into submodule path '\$sm_path' failed")"
fi