[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] git-version-gen: Fix for tags containing '-'
From: |
Markus Armbruster |
Subject: |
Re: [PATCH] git-version-gen: Fix for tags containing '-' |
Date: |
Mon, 07 Aug 2017 07:47:58 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) |
Paul Eggert <address@hidden> writes:
> Markus Armbruster wrote:
>> there's an additional problem my patch fails to address:
>>
>> # Change the first '-' to a '.', so version-comparing tools work
>> properly.
>> # Remove the "g" in git describe's output string, to save a byte.
>> v=`echo "$v" | sed 's/-/./;s/\(.*\)-g/\1-/'`;
>>
>> Messes with '-' in tags. I think it should replace the first '-g'
>> instead. What do you think?
>
> Sorry, I'm not following. Could you give an example of the problem?
> Evidently the code is messing with the first "-" and the last "-g"
> deliberately.
I was too terse, and not entirely accurate, sorry. Let me try again.
If I understand this code's intent correctly, it tries to change the "-"
separating the tag from the number of additional commits to ".", and the
"-g" separating the number of additional commits from the abbreviated
object name to just "-". Example:
v0.1-1496-gcbc7002
becomes
v0.1.1496-cbc7002
The problem is once again tag names containing "-", because then the
first "-" is *not* the one we want to change.
Example:
$ git-tag -m test v0.2-rc1 HEAD^
$ git-describe
v0.2-rc1-1-gcbc7002
$ build-aux/git-version-gen .tarball-version; echo
0.2.rc1-1-cbc700
We change the tag name instead of the "-" seperating it from the number
of commits.
After the next commit, we'll get "0.2.rc1-2-cbc700". Will those two
version-compare correctly?
Example:
$ git-tag -fm test v0.2-rc1
Updated tag 'v0.2-rc1' (was 1657134)
$ git-describe
v0.2-rc1
$ build-aux/git-version-gen .tarball-version; echo
0.2.rc1
There is no number of commits to change. We change the tag name
instead.
Should we replace /-([^-]+)-g([^-]*)$/ by /.\1-\2/? Extended regexp
for clarity. Tighter matching would be possible, say
/-([0-9]+)-g[0-9a-f]{4,}$/.
- [PATCH] git-version-gen: Fix for tags containing '-', Markus Armbruster, 2017/08/06
- Re: [PATCH] git-version-gen: Fix for tags containing '-', Jim Meyering, 2017/08/06
- Re: [PATCH] git-version-gen: Fix for tags containing '-', Paul Eggert, 2017/08/06
- Re: [PATCH] git-version-gen: Fix for tags containing '-', Jim Meyering, 2017/08/06
- Re: [PATCH] git-version-gen: Fix for tags containing '-', Markus Armbruster, 2017/08/06
- Re: [PATCH] git-version-gen: Fix for tags containing '-', Paul Eggert, 2017/08/06
- Re: [PATCH] git-version-gen: Fix for tags containing '-',
Markus Armbruster <=
- Re: [PATCH] git-version-gen: Fix for tags containing '-', Paul Eggert, 2017/08/07
- Re: [PATCH] git-version-gen: Fix for tags containing '-', Markus Armbruster, 2017/08/07