scripts/get_git: fix a couple of errors

This commit is contained in:
MilhouseVH 2018-11-15 15:22:12 +00:00
parent 3cfc80ccf2
commit 33e1b1b1c0

View File

@ -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;}')