Skip to content

Commit 036188a

Browse files
committed
git-extra: fix the pkgver logic again
In 48e2403 (git-extra: ignore generated changes for the sake of `pkgver`, 2025-03-05) I tried to address the fact that the commit that updates `pkgver` in `PKGBUILD` necessarily touches the `git-extra/` subdirectory, yet should not be considered for the package version. What I failed to address is the rare case when `HEAD` is not the same as `$rev`, i.e. when the last commit that touched the `git-extra/` directory` is not at the tip of the branch. Let's accommodate for that, too. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
1 parent d90bdff commit 036188a

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

git-extra/PKGBUILD

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,11 @@ pkgver() {
2020
cd "$startdir"
2121
test ! -f "$(git rev-parse --git-path shallow)" || git -c http.sslbackend fetch --unshallow
2222
rev="$(git rev-list -1 HEAD -- . ':(exclude)./git-extra.install')"
23-
test -n "$(git show . ':(exclude)./git-extra.install' |
24-
sed -n -e '1,/^@@/d' -e '/^[-+]pkgver=/d' -e '/^[-+]pkgver=/d' -e "/^[-+] *'[0-9a-f]\{64\}'$/d" -e '/^[-+]/p')" ||
25-
rev="$(git rev-list -1 $rev^ -- .)"
23+
while test -z "$(git show $rev . ':(exclude)./git-extra.install' |
24+
sed -n -e '1,/^@@/d' -e '/^[-+]pkgver=/d' -e '/^[-+]pkgver=/d' -e "/^[-+] *'[0-9a-f]\{64\}'$/d" -e '/^[-+]/p')"
25+
do
26+
rev="$(git rev-list -1 $rev^ -- .)"
27+
done
2628
printf "%s.%s.%s" "${_ver_base}" "$(git rev-list --count $rev -- .)" \
2729
"$(git rev-parse --short=9 $rev)"
2830
}

0 commit comments

Comments
 (0)