git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Michal Novotny <clime@redhat.com>
To: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: allow "~" to be present in a tag name
Date: Tue, 13 Mar 2018 12:35:08 +0100	[thread overview]
Message-ID: <CANT8FXSN7-fD7YCqr=asraG-ttupiJfrzhCNaW86-RQ4m05Rbw@mail.gmail.com> (raw)
In-Reply-To: <87zi3cp9rp.fsf@evledraar.gmail.com>

On Tue, Mar 13, 2018 at 11:09 AM, Ævar Arnfjörð Bjarmason
<avarab@gmail.com> wrote:
>
> On Tue, Mar 13 2018, Michal Novotny jotted:
>
>> On Tue, Mar 13, 2018 at 10:07 AM, Ævar Arnfjörð Bjarmason
>> <avarab@gmail.com> wrote:
>>>
>>> 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?
>
> We could make that work, with some caveats:
>
>  1) The syntax we've reserved for refnames is quite small, and my bias
>     at least would be to say you should just make a tag like
>     rpkg-util-1.4-rc1 instead (as e.g. git.git and linux.git do).

There is kind of clash of symbolics with rpm world. In rpm world, the component
after the last dash in a package full (versioned) name is usually
reserved for a downstream
packager who increments it as he/she adds patches to the original
sources. I will
need to do slightly more research here of what is possible.

Thank you so far!

>
>     Carving out an exception like this also means we couldn't use
>     ~[^0-9].* for anything magical in the future.
>
>     But I think that's a rather small objection, we have other syntax
>     escape hatches, and we're unlikely to use ~[^0-9].* as some new
>     magic.
>
>  2) If we patch git to accept this, you'll be creating refs that aren't
>     inter-operable with previous versions of git.
>
>     This is a big deal. E.g. you'll happily create this special ref,
>     then try to push it to github, and they'll croak because that's an
>     invalid ref to them. Ditto some co-worker of yours who's using an
>     older version of git.
>
>     FWIW if you manually create such a tag e.g. for-each-ref will emit
>     'warning: ignoring ref with broken name' and just not show it.
>
>>>
>>> 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

  reply	other threads:[~2018-03-13 11:35 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-13  8:11 allow "~" to be present in a tag name Michal Novotny
2018-03-13  9:07 ` Ævar Arnfjörð Bjarmason
2018-03-13  9:36   ` Michal Novotny
2018-03-13 10:09     ` Ævar Arnfjörð Bjarmason
2018-03-13 11:35       ` Michal Novotny [this message]
2018-03-15  8:39       ` Ævar Arnfjörð Bjarmason
2018-03-14  0:07 ` Jonathan Nieder

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CANT8FXSN7-fD7YCqr=asraG-ttupiJfrzhCNaW86-RQ4m05Rbw@mail.gmail.com' \
    --to=clime@redhat.com \
    --cc=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).