Paul Eggert <> 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:




The problem is once again tag names containing "-", because then the
first "-" is *not* the one we want to change.


    $ git-tag -m test v0.2-rc1 HEAD^
    $ git-describe 
    $ build-aux/git-version-gen .tarball-version; echo

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?


    $ git-tag -fm test v0.2-rc1
    Updated tag 'v0.2-rc1' (was 1657134)
    $ git-describe 
    $ build-aux/git-version-gen .tarball-version; echo

There is no number of commits to change.  We change the tag name

Should we replace /-([^-]+)-g([^-]*)$/ by /.\1-\2/?  Extended regexp
for clarity.  Tighter matching would be possible, say

Reply via email to