From 33e1b1b1c078c79d36d04f6bf3916c288364da7e Mon Sep 17 00:00:00 2001 From: MilhouseVH Date: Thu, 15 Nov 2018 15:22:12 +0000 Subject: [PATCH 1/2] scripts/get_git: fix a couple of errors --- scripts/get_git | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/get_git b/scripts/get_git index 7b8d0d087f..f9f56bd329 100755 --- a/scripts/get_git +++ b/scripts/get_git @@ -76,7 +76,7 @@ for d in "${SOURCES}/${1}/${1}-"* ; do if [ "${GIT_FOUND}" = "no" ]; then cd "${d}" if [ "${PKG_URL}" = "$(git remote get-url origin)" ]; then - if [[ -z "${PKG_GIT_CLONE_BRANCH}"]] || [[ $(git branch | grep "^\* ${PKG_GIT_CLONE_BRANCH}$" | wc -l) -eq 1 ]]; then + if [[ -z "${PKG_GIT_CLONE_BRANCH}" ]] || [[ $(git branch | grep "^\* ${PKG_GIT_CLONE_BRANCH}$" | wc -l) -eq 1 ]]; then GIT_FOUND="yes" GIT_DIR="${d}" _get_repo_clean @@ -115,7 +115,7 @@ cd "${opwd}" if [ "${GIT_FOUND}" = "no" ]; then printf "%${BUILD_INDENT}c $(print_color CLR_GET "GIT CLONE") ${1}\n" ' '>&$SILENT_OUT - git clone "${GIT_CLONE_PARAMS}" "${PKG_URL}" "${PACKAGE}" + git clone ${GIT_CLONE_PARAMS} "${PKG_URL}" "${PACKAGE}" else if [ ! "${GIT_DIR}" = "${PACKAGE}" ]; then mv "${GIT_DIR}" "${PACKAGE}" @@ -126,7 +126,7 @@ fi [ $(git log --oneline --pretty=tformat:"%H" | grep "^${PKG_VERSION}" | wc -l) -eq 1 ] || die "There is no commit '${PKG_VERSION}' on branch '$(git branch | grep ^\* | cut -d ' ' -f2)' of package '${1}'! Aborting!" git reset --hard "${PKG_VERSION}" printf "%${BUILD_INDENT}c $(print_color CLR_GET "GIT SUBMODULE") ${1}\n" ' '>&$SILENT_OUT - git submodule update --init --recursive "${GIT_SUBMODULE_PARAMS}" + git submodule update --init --recursive ${GIT_SUBMODULE_PARAMS} ) GIT_SHA=$(git ls-remote "${PACKAGE}" | grep -m1 HEAD | awk '{print $1;}') From 8eb628e4f724d3cd1ca51e2bd2094b911eb04517 Mon Sep 17 00:00:00 2001 From: MilhouseVH Date: Thu, 15 Nov 2018 15:22:40 +0000 Subject: [PATCH 2/2] scripts/get_git: additional cleanup --- scripts/get_git | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/get_git b/scripts/get_git index f9f56bd329..f7866f5d61 100755 --- a/scripts/get_git +++ b/scripts/get_git @@ -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