qemu-patch-raspberry4/scripts/git-submodule.sh
Daniel P. Berrange 8172bdb2d0 scripts: don't throw away stderr when checking out git submodules
The stderr from git is important if git fails to checkout modules
due to network problems, or other unexpected errors.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 20171020130748.22983-1-berrange@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2017-10-23 08:10:18 +02:00

39 lines
735 B
Bash
Executable file

#!/bin/sh
#
# This code is licensed under the GPL version 2 or later. See
# the COPYING file in the top-level directory.
set -e
substat=".git-submodule-status"
command=$1
shift
modules="$@"
if test -z "$modules"
then
test -e $substat || touch $substat
exit 0
fi
if ! test -e ".git"
then
echo "$0: unexpectedly called with submodules but no git checkout exists"
exit 1
fi
case "$command" in
status)
test -f "$substat" || exit 1
trap "rm -f ${substat}.tmp" EXIT
git submodule status $modules > "${substat}.tmp"
diff "${substat}" "${substat}.tmp" >/dev/null
exit $?
;;
update)
git submodule update --init $modules 1>/dev/null
git submodule status $modules > "${substat}"
;;
esac