diff --git a/show_possible_srpms.sh b/show_possible_srpms.sh index 83c4d08..1c1eef3 100755 --- a/show_possible_srpms.sh +++ b/show_possible_srpms.sh @@ -97,11 +97,7 @@ if [[ ! -d .git ]] || [[ ! -d SPECS ]]; then exit 1 fi -# commit message contains white space, set IFS to \n -IFS=' -' - -LOGARGS="--pretty=%H|\%s" +LOGARGS="--pretty='%H|%s'" if [[ ${RHELONLY} -eq 1 ]]; then LOGARGS="${LOGARGS} --author='${RHELAUTHOR}'" fi @@ -110,29 +106,35 @@ if [[ "x${BRANCH}" != 'x' ]]; then LOGARGS="${LOGARGS} ${BRANCH}" fi -loglist=$(git log ${LOGARGS} |grep import) +loglist="$(eval "git log ${LOGARGS}" | grep import)" if [[ $? -ne 0 ]]; then exit 1 fi +# split loglist on newline +splitloglist() +{ + local IFS=$'\n' + loglist=($loglist) +} +splitloglist + # flag for if nothing is found FOUND=False -for entry in $loglist; do +for entry in "${loglist[@]}"; do FOUND=True - pkg=$(echo ${entry} | cut -d' ' -f2) + pkg=$(echo "${entry}" | cut -d' ' -f2) # strip .src.rpm if present nvr="${pkg%.src.rpm}" if [[ ${WITHCOMMITHASH} -eq 1 ]]; then - shasum=$(echo ${entry} | cut -d'|' -f1) + shasum=$(echo "${entry}" | cut -d'|' -f1) echo "${shasum}:${nvr}.src.rpm" else echo "${nvr}.src.rpm" fi done -if [ "${FOUND}" != "True" ] -then +if [ "${FOUND}" != "True" ]; then warn "No SRPMs found" fi -