Re: [Openvpn-devel] [PATCH] git-version.py: use tag as branch name

2022-12-16 Thread Frank Lichtenheld
On Fri, Dec 16, 2022 at 11:07:17AM +0200, Lev Stipakov wrote:
> From: Lev Stipakov 
> 
> Git magic to get branch name
> 
>   git rev-parse --symbolic-full-name HEAD
> 
> doesn't work when we're on tag, which is the case when
> we build releases. In this case, use tag name as branch name
> with another git magic:
> 
>   git describe --tags
> 
> This fixes https://github.com/OpenVPN/openvpn/issues/199.

NAK.

I would propose to invert the logic:

Do "git describe --exact-match" first.

That matches only annotated tags that point to this commit.
So it will actually use the tag consistently independent of
whether you have the commit checked out with detached HEAD
or via the release branch.

And then fall back to the previous mechanism if that doesn't
match.

Regards,
-- 
  Frank Lichtenheld


___
Openvpn-devel mailing list
Openvpn-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openvpn-devel


Re: [Openvpn-devel] [PATCH] git-version.py: use tag as branch name

2022-12-16 Thread Marc Becker
Hi,

> From: Lev Stipakov 
> 
> Git magic to get branch name
> 
>   git rev-parse --symbolic-full-name HEAD
> 
> doesn't work when we're on tag, which is the case when
> we build releases. In this case, use tag name as branch name
> with another git magic:
> 
>   git describe --tags
> 
> This fixes https://github.com/OpenVPN/openvpn/issues/199.
> 
> Signed-off-by: Lev Stipakov 
> ---


For me, reason for "rev-parse" failing is detached HEAD (not clear from commit 
message).
Likely, builder creates checkout for commit-ID without local branches.

For stability purposes, I'd throw in an "--exact-match" to increase "none" 
fallback conditions,
so things like "v2.6_beta1-22-g73cab722/g73c…" will not end up in the version 
string.


Kind Regards,
Marc Becker


___
Openvpn-devel mailing list
Openvpn-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openvpn-devel