You are not logged in.
Hi there !
Well, i spent some time creating my pkgver function for git repos.
The main point is that, when a tag is present, the hash value should NOT be the tag one but the LAST COMMIT one Well that's my point of view.
That's not the case for the examples in the wiki.
pkgver() {
cd "$srcdir/$_gitname"
printf "%s.%s" "$( set -o pipefail
git describe --long --tags 2>/dev/null \
| sed 's/\([^-]*-g\)/r\1/;s/-/./g' \
| sed -r 's/.([0-9,a-g,A-G]{7}.*)//' ||
printf "r%s" "$(git rev-list --count HEAD)"
)" "$(git rev-parse --short HEAD)"
}
What do you think about this ?
Thanks
Salamandar
Offline
Personally, I'm a proponent of simple pkgver functions shaped to the git repo in question, rather than .. things like this. But whatever works I suppose...
Mods are just community members who have the occasionally necessary option to move threads around and edit posts. -- Trilby
Offline
Well I understand what you mean ^^
But the whole "sed" thing is just here to make versions pretty and useable.
Offline
The main point is that, when a tag is present, the hash value should NOT be the tag one but the LAST COMMIT one Well that's my point of view.
That's not the case for the examples in the wiki.
Are you certain of that? Completely certain?
Online
Yup, absolutely. If I use the last example (I added the missing "--tags") :
$ cd fretwork
$ pkgver() {
cd "$srcdir$pkgname"
( set -o pipefail
git describe --tags --long 2>/dev/null | sed 's/\([^-]*-g\)/r\1/;s/-/./g' ||
printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
)
}
$ pkgver
0.1.1.r2.g7d1bb80
$ git tag | xargs git tag -d # Delete all the tags from the git repo
Étiquette '0.1.1' supprimée (elle était sur f7ea800)
$ pkgver # This will give the last commit on master
r12.7d1bb80
So you can see the last string is not the same…
EDIT :
Hum, well, I can see where i missread. I did not see there was a "g" before the commit hash in "0.1.1.r2.g7d1bb80". So I just assumed it was a different hash value ^^''
What does this "g" mean ?
Last edited by Salamandar (2015-10-20 18:48:38)
Offline
The "g" is just git describe's identifier that it's the hash. It's not part of the hash itself.
Online
Yeah. But I don't understand why there is a "g" with git describe but not with git rev-parse.
Anyways… So my "hack" is useless ^^''
Offline