Emacsg: bin/borg-bootstrap: don't use sub-shells

This commit is contained in:
Jonas Bernoulli 2016-12-01 16:07:02 +01:00
parent bfd6b10a27
commit 19d1fae6ce

View File

@ -39,6 +39,8 @@
hive_remote=$(git config -f .gitmodules borg.collective) hive_remote=$(git config -f .gitmodules borg.collective)
push_remote=$(git config -f .gitmodules borg.pushDefault) push_remote=$(git config -f .gitmodules borg.pushDefault)
toplevel=$(git rev-parse --show-toplevel)
git submodule--helper list | git submodule--helper list |
while read mode sha1 stage path while read mode sha1 stage path
do do
@ -64,16 +66,14 @@ do
--url "$remote_url" && --url "$remote_url" &&
git remote rename origin "$remote" git remote rename origin "$remote"
else else
(
cd "$path" cd "$path"
git remote add "$remote" "$remote_url" git remote add "$remote" "$remote_url"
git fetch "$remote" git fetch "$remote"
) cd "$toplevel"
fi fi
if test -e "$path"/.git if test -e "$path"/.git
then then
(
cd "$path" cd "$path"
if test "$remote" = "$hive_remote" if test "$remote" = "$hive_remote"
then then
@ -83,17 +83,16 @@ do
then then
git config remote.pushDefault "$remote" git config remote.pushDefault "$remote"
fi fi
) cd "$toplevel"
fi fi
done done
if test -e "$path"/.git if test -e "$path"/.git
then then
(
cd "$path" cd "$path"
git reset --hard "$sha1" || git reset --hard "$sha1" ||
echo >&2 "futile: checkout of '$sha1' into submodule path '$path' failed" echo >&2 "futile: checkout of '$sha1' into submodule path '$path' failed"
) cd "$toplevel"
else else
echo >&2 "futile: clone of any remote into submodule path '$path' failed" echo >&2 "futile: clone of any remote into submodule path '$path' failed"
fi fi