scripts/get_git: additional cleanup

This commit is contained in:
MilhouseVH 2018-11-15 15:22:40 +00:00
parent 33e1b1b1c0
commit 8eb628e4f7

View File

@ -55,7 +55,7 @@ GIT_SUBMODULE_PARAMS=""
if [ -n "${PKG_GIT_CLONE_DEPTH}" ]; then
if [[ "${PKG_GIT_CLONE_DEPTH}" =~ ^[0-9]+$ ]]; then
GIT_CLONE_PARAMS="$GIT_CLONE_PARAMS --depth ${PKG_GIT_CLONE_DEPTH}"
GIT_CLONE_PARAMS="${GIT_CLONE_PARAMS} --depth ${PKG_GIT_CLONE_DEPTH}"
else
die "ERROR: PKG_GIT_CLONE_DEPTH is not a number! (${PKG_GIT_CLONE_DEPTH})"
fi
@ -70,7 +70,7 @@ if [ -n "${PKG_GIT_SUBMODULE_DEPTH}" ]; then
fi
GIT_FOUND="no"
opwd=$(pwd)
opwd="$(pwd)"
for d in "${SOURCES}/${1}/${1}-"* ; do
if [ -d "${d}/.git" ]; then
if [ "${GIT_FOUND}" = "no" ]; then
@ -95,7 +95,7 @@ for d in "${SOURCES}/${1}/${1}-"* ; do
cd "${opwd}"
rm -rf "${d}"
fi
if [ "$GIT_FOUND" = "yes" ]; then
if [ "${GIT_FOUND}" = "yes" ]; then
printf "%${BUILD_INDENT}c $(print_color CLR_GET "GIT PULL") ${1}\n" ' '>&$SILENT_OUT
git pull
cd "${opwd}"
@ -129,7 +129,7 @@ fi
git submodule update --init --recursive ${GIT_SUBMODULE_PARAMS}
)
GIT_SHA=$(git ls-remote "${PACKAGE}" | grep -m1 HEAD | awk '{print $1;}')
GIT_SHA="$(git ls-remote "${PACKAGE}" | grep -m1 HEAD | awk '{print $1;}')"
if [ -n "${PKG_GIT_SHA}" ]; then
[ "${PKG_GIT_SHA}" = "${GIT_SHA}" ] || printf "%${BUILD_INDENT}c $(print_color CLR_WARNING "WARNING") Incorrect git hash in respository: got ${GIT_SHA}, wanted ${PKG_GIT_SHA}\n\n" ' '>&$SILENT_OUT