lib-submodule-update.sh: replace sha1 by hash

Cleaning up code by generalising it.
Currently the mailing list discusses yet again how
to migrate away from sha1.

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Stefan Beller 2017-03-14 14:46:29 -07:00 committed by Junio C Hamano
parent 2f70edccb4
commit 03c7e2a321

View File

@ -171,9 +171,9 @@ reset_work_tree_to () {
git checkout -f "$1" && git checkout -f "$1" &&
git status -u -s >actual && git status -u -s >actual &&
test_must_be_empty actual && test_must_be_empty actual &&
sha1=$(git rev-parse --revs-only HEAD:sub1) && hash=$(git rev-parse --revs-only HEAD:sub1) &&
if test -n "$sha1" && if test -n "$hash" &&
test $(cd "../submodule_update_sub1" && git rev-parse --verify "$sha1^{commit}") test $(cd "../submodule_update_sub1" && git rev-parse --verify "$hash^{commit}")
then then
git submodule update --init --recursive "sub1" git submodule update --init --recursive "sub1"
fi fi