about summary refs log tree commit diff
path: root/xbump
diff options
context:
space:
mode:
Diffstat (limited to 'xbump')
-rwxr-xr-xxbump19
1 files changed, 14 insertions, 5 deletions
diff --git a/xbump b/xbump
index e970a19..df30d9f 100755
--- a/xbump
+++ b/xbump
@@ -1,10 +1,19 @@
-#!/bin/sh
+#!/bin/sh -e
 # xbump PKGNAME [git commit options] - git commit a version bump
 
-cd ~/xbps-packages
+cd $(xdistdir)
 
 pkg=$1; shift
-version=$(./xbps-src show "$pkg" | sed -n '/version/s/[^:]*:[\t]*//p')
+version=$(./xbps-src show "$pkg" | sed -n '/^version/s/[^:]*:[\t]*//p')
 
-git add srcpkgs/"$pkg" &&
-git commit -m "$pkg: update to $version." "$@" srcpkgs/"$pkg"
+if [ -n "$(git ls-files srcpkgs/"$pkg"/template)" ]; then
+	msg="$pkg: update to $version."
+else
+	msg="New package: $pkg-$version"
+fi
+
+dirs=$(./xbps-src show "$pkg" |
+	sed -n '/^\(pkgname\|subpackage\)/s/[^:]*:[\t]*/srcpkgs\//p')
+
+git add $dirs
+git commit -m "$msg" "$@" $dirs