git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: allow "~" to be present in a tag name

From
MNMichal Novotny <clime@redhat.com>
Date
Mar 13, 2018, 09:36 UTC
Message-ID
<CANT8FXTT=5sGp9Wn4h5t=k4TiiADQrf--hDv5EmCx=KoGHgwXg@mail.gmail.com>
In-Reply-To
<873714qr7i.fsf@evledraar.gmail.com>

On Tue, Mar 13, 2018 at 10:07 AM, Ævar Arnfjörð Bjarmason <avarab@gmail.com> wrote:

Show 24 quoted lines
>
> On Tue, Mar 13 2018, Michal Novotny jotted:
>
>> Hello,
>>
>> currently, if I try to create a tag that has tilde "~"  in name, an
>> error is raised. E.g.
>>
>> $ git tag rpkg-util-1.4~rc1
>> fatal: 'rpkg-util-1.4~rc1' is not a valid tag name.
>>
>> Now, actually it would be very cool if tilde was allowed in a tag name
>> because we would like to use it for tagging pre-releases of (not-only
>> rpm) packages.
>>
>> Is there some deep technical reason why tilde cannot be present in a
>> tag name? I tried that e.g.
>
> Yes, because a trailing tilde is part of git's rev syntax, see "man
> git-rev-parse", or try in any repo:
>
>     git show HEAD
>     git show HEAD~2
>     git show HEAD^~2
Right, reading the man pages:
<rev>~<n>, e.g. master~3
           A suffix ~<n> to a revision parameter means the commit
object that is the <n>th generation ancestor of the named commit
object, following only the first
           parents. I.e.  <rev>~3 is equivalent to <rev>^^^ which is
equivalent to <rev>^1^1^1. See below for an illustration of the usage
of this form.

Would it be acceptable to disallow only ~<n> (<n> as [0-9]+) in a tag name but allow ~[^0-9].*, i.e. if the immediately following symbol after '~' is a letter, do not interpret ~ as a special character. Could it work?

Thank you! clime

Show 13 quoted lines
>
> etc.
>
> Although I guess git could learn to disambiguate that form from the tag
> you're trying to create.
>
>> git tag rpkg-util-1.4%rc1
>>
>> but percentage sign does not seem to be particular fitting for
>> pre-release marking.
>>
>> Thank you
>> clime
Previous: Ævar Arnfjörð BjarmasonNext: Ævar Arnfjörð Bjarmason
Message 3 of 7 in “allow "~" to be present in a tag name”
  1. Michal NovotnyMar 13, 2018
  2. Ævar Arnfjörð BjarmasonMar 13, 2018
  3. Michal NovotnyMar 13, 2018
  4. Ævar Arnfjörð BjarmasonMar 13, 2018
  5. Michal NovotnyMar 13, 2018
  6. Ævar Arnfjörð BjarmasonMar 15, 2018
  7. Jonathan NiederMar 14, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.