diff options
Diffstat (limited to 'librecommit')
-rwxr-xr-x | librecommit | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/librecommit b/librecommit index 9444bd9..d9a9164 100755 --- a/librecommit +++ b/librecommit @@ -27,36 +27,38 @@ usage () { echo echo "This script commits the package using name, pkgver an pkgver" echo + exit 1 } -msg='Commiting libre package $pkg-$pkgver-$pkgrel' -files="" +msg="Commiting libre package \"\$pkg-\$pkgver-\$pkgrel\"" for opt in $@ ; do case ${opt} in - h) usage ;; - m) msg=${OPTARG} ;; - *) files+="${opt} " ;; + -h) usage ;; + -m) shift; msg=${1}; shift ;; + *) files+="${1} " ; shift ;; esac done -if [ ! -e PKGBUILD ]; then exit 1; fi +if [ ! -e PKGBUILD -o -z "$files" ]; then usage; fi source PKGBUILD pkg=${pkgbase:-${pkgname}} -if [ ${COMMITCD} = 'git' ]; then +msg=$(eval echo $msg) - ${COMMITCD} add $@ && ${COMMITCD} -m "" +if [ "$COMMITCMD" = 'git' ]; then -elif [ ${COMMITCD} = 'hg' ]; then + ${COMMITCMD} add ${files} && ${COMMITCMD} commit -m "$(echo $msg)" - ${COMMITCMD} commit $@ -m -v || exit 1 +elif [ "$COMMITCMD" = 'hg' ]; then + + ${COMMITCMD} commit ${files} -m "$msg" -v || exit 1 else - error "COMMITCD is not correctly set on libretools.conf" + error "COMMITCMD is not correctly set on libretools.conf" fi |