summaryrefslogtreecommitdiff
path: root/commit-package
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2021-01-13 19:25:35 +0100
committerErich Eckner <git@eckner.net>2021-01-13 19:25:35 +0100
commit35c37674e123b5d0bce5f577ffb2edeb28cf8308 (patch)
tree2de5c2b70fd0c54e73d2ce820a06435d3bcb3c73 /commit-package
parent96c2654fbdb4a567e79d1c36a339993035b152d0 (diff)
downloadarchlinuxewe-35c37674e123b5d0bce5f577ffb2edeb28cf8308.tar.xz
commit-package: auto-commit-message-generation new
Diffstat (limited to 'commit-package')
-rwxr-xr-xcommit-package26
1 files changed, 25 insertions, 1 deletions
diff --git a/commit-package b/commit-package
index 65ad5b2d8..80303cebf 100755
--- a/commit-package
+++ b/commit-package
@@ -18,7 +18,31 @@ pdiff () {
unset commit_message
if [ $# -eq 1 ]; then
- commit_message="$1"
+ if [ "x$1" = 'x-a' ]; then
+ commit_message=$(
+ unset pkgname pkgbase epoch pkgver pkgrel
+ eval "$(
+ git archive HEAD -- PKGBUILD \
+ | tar -Ox \
+ | grep '^\(pkgname\|pkgbase\|epoch\|pkgver\|pkgrel\)='
+ )"
+ printf '%s: %s%s-%s -> ' \
+ "${pkgbase}${pkgbase:-${pkgname}}" \
+ "${epoch:+${epoch}:}" \
+ "${pkgver}" \
+ "${pkgrel}"
+ unset epoch pkgver pkgrel
+ eval "$(
+ grep '^\(epoch\|pkgver\|pkgrel\)=' PKGBUILD
+ )"
+ printf '%s%s-%s' \
+ "${epoch:+${epoch}:}" \
+ "${pkgver}" \
+ "${pkgrel}"
+ )
+ else
+ commit_message="$1"
+ fi
elif [ $# -ne 0 ]; then
>&2 'usage: commit-package [commit-message]'
>&2 ' without a commit message, it will only be added for commit'