From 35c37674e123b5d0bce5f577ffb2edeb28cf8308 Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Wed, 13 Jan 2021 19:25:35 +0100 Subject: commit-package: auto-commit-message-generation new --- commit-package | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'commit-package') 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' -- cgit v1.2.3-70-g09d2