{"thread":{"id":"48029","subject":"allow \"~\" to be present in a tag name","startedAt":"2018-03-13T08:11:55Z","lastAt":"2018-03-15T08:39:44Z","messageCount":7,"participants":["Michal Novotny","Ævar Arnfjörð Bjarmason","Jonathan Nieder"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"341525","messageId":"CANT8FXTF41-4zvqvrEek262D8OZRhA4nsiPguyNTL9mwF1+mkg@mail.gmail.com","threadId":"48029","inReplyTo":null,"subject":"allow \"~\" to be present in a tag name","fromName":"Michal Novotny","fromEmail":"clime@redhat.com","sentAt":"2018-03-13T08:11:49Z","receivedAt":"2018-03-13T08:11:55Z","isPatch":false,"sender":{"key":"clime@redhat.com","avatar":null},"body":"Hello,\n\ncurrently, if I try to create a tag that has tilde \"~\"  in name, an\nerror is raised. E.g.\n\n$ git tag rpkg-util-1.4~rc1\nfatal: 'rpkg-util-1.4~rc1' is not a valid tag name.\n\nNow, actually it would be very cool if tilde was allowed in a tag name\nbecause we would like to use it for tagging pre-releases of (not-only\nrpm) packages.\n\nIs there some deep technical reason why tilde cannot be present in a\ntag name? I tried that e.g.\n\ngit tag rpkg-util-1.4%rc1\n\nbut percentage sign does not seem to be particular fitting for\npre-release marking.\n\nThank you\nclime\n"},{"id":"341526","messageId":"873714qr7i.fsf@evledraar.gmail.com","threadId":"48029","inReplyTo":"CANT8FXTF41-4zvqvrEek262D8OZRhA4nsiPguyNTL9mwF1+mkg@mail.gmail.com","subject":"Re: allow \"~\" to be present in a tag name","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2018-03-13T09:07:13Z","receivedAt":"2018-03-13T09:07:21Z","isPatch":false,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"\nOn Tue, Mar 13 2018, Michal Novotny jotted:\n\n> Hello,\n>\n> currently, if I try to create a tag that has tilde \"~\"  in name, an\n> error is raised. E.g.\n>\n> $ git tag rpkg-util-1.4~rc1\n> fatal: 'rpkg-util-1.4~rc1' is not a valid tag name.\n>\n> Now, actually it would be very cool if tilde was allowed in a tag name\n> because we would like to use it for tagging pre-releases of (not-only\n> rpm) packages.\n>\n> Is there some deep technical reason why tilde cannot be present in a\n> tag name? I tried that e.g.\n\nYes, because a trailing tilde is part of git's rev syntax, see \"man\ngit-rev-parse\", or try in any repo:\n\n    git show HEAD\n    git show HEAD~2\n    git show HEAD^~2\n\netc.\n\nAlthough I guess git could learn to disambiguate that form from the tag\nyou're trying to create.\n\n> git tag rpkg-util-1.4%rc1\n>\n> but percentage sign does not seem to be particular fitting for\n> pre-release marking.\n>\n> Thank you\n> clime\n"},{"id":"341527","messageId":"CANT8FXTT=5sGp9Wn4h5t=k4TiiADQrf--hDv5EmCx=KoGHgwXg@mail.gmail.com","threadId":"48029","inReplyTo":"873714qr7i.fsf@evledraar.gmail.com","subject":"Re: allow \"~\" to be present in a tag name","fromName":"Michal Novotny","fromEmail":"clime@redhat.com","sentAt":"2018-03-13T09:36:02Z","receivedAt":"2018-03-13T09:36:09Z","isPatch":false,"sender":{"key":"clime@redhat.com","avatar":null},"body":"On Tue, Mar 13, 2018 at 10:07 AM, Ævar Arnfjörð Bjarmason\n<avarab@gmail.com> wrote:\n>\n> On Tue, Mar 13 2018, Michal Novotny jotted:\n>\n>> Hello,\n>>\n>> currently, if I try to create a tag that has tilde \"~\"  in name, an\n>> error is raised. E.g.\n>>\n>> $ git tag rpkg-util-1.4~rc1\n>> fatal: 'rpkg-util-1.4~rc1' is not a valid tag name.\n>>\n>> Now, actually it would be very cool if tilde was allowed in a tag name\n>> because we would like to use it for tagging pre-releases of (not-only\n>> rpm) packages.\n>>\n>> Is there some deep technical reason why tilde cannot be present in a\n>> tag name? I tried that e.g.\n>\n> Yes, because a trailing tilde is part of git's rev syntax, see \"man\n> git-rev-parse\", or try in any repo:\n>\n>     git show HEAD\n>     git show HEAD~2\n>     git show HEAD^~2\n\nRight, reading the man pages:\n\n<rev>~<n>, e.g. master~3\n           A suffix ~<n> to a revision parameter means the commit\nobject that is the <n>th generation ancestor of the named commit\nobject, following only the first\n           parents. I.e.  <rev>~3 is equivalent to <rev>^^^ which is\nequivalent to <rev>^1^1^1. See below for an illustration of the usage\nof this form.\n\nWould it be acceptable to disallow only ~<n> (<n> as [0-9]+) in a tag\nname but allow ~[^0-9].*, i.e. if the immediately following symbol\nafter '~' is a letter, do not\ninterpret ~ as a special character. Could it work?\n\nThank you!\nclime\n\n>\n> etc.\n>\n> Although I guess git could learn to disambiguate that form from the tag\n> you're trying to create.\n>\n>> git tag rpkg-util-1.4%rc1\n>>\n>> but percentage sign does not seem to be particular fitting for\n>> pre-release marking.\n>>\n>> Thank you\n>> clime\n"},{"id":"341529","messageId":"87zi3cp9rp.fsf@evledraar.gmail.com","threadId":"48029","inReplyTo":"CANT8FXTT=5sGp9Wn4h5t=k4TiiADQrf--hDv5EmCx=KoGHgwXg@mail.gmail.com","subject":"Re: allow \"~\" to be present in a tag name","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2018-03-13T10:09:14Z","receivedAt":"2018-03-13T10:09:22Z","isPatch":false,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"\nOn Tue, Mar 13 2018, Michal Novotny jotted:\n\n> On Tue, Mar 13, 2018 at 10:07 AM, Ævar Arnfjörð Bjarmason\n> <avarab@gmail.com> wrote:\n>>\n>> On Tue, Mar 13 2018, Michal Novotny jotted:\n>>\n>>> Hello,\n>>>\n>>> currently, if I try to create a tag that has tilde \"~\"  in name, an\n>>> error is raised. E.g.\n>>>\n>>> $ git tag rpkg-util-1.4~rc1\n>>> fatal: 'rpkg-util-1.4~rc1' is not a valid tag name.\n>>>\n>>> Now, actually it would be very cool if tilde was allowed in a tag name\n>>> because we would like to use it for tagging pre-releases of (not-only\n>>> rpm) packages.\n>>>\n>>> Is there some deep technical reason why tilde cannot be present in a\n>>> tag name? I tried that e.g.\n>>\n>> Yes, because a trailing tilde is part of git's rev syntax, see \"man\n>> git-rev-parse\", or try in any repo:\n>>\n>>     git show HEAD\n>>     git show HEAD~2\n>>     git show HEAD^~2\n>\n> Right, reading the man pages:\n>\n> <rev>~<n>, e.g. master~3\n>            A suffix ~<n> to a revision parameter means the commit\n> object that is the <n>th generation ancestor of the named commit\n> object, following only the first\n>            parents. I.e.  <rev>~3 is equivalent to <rev>^^^ which is\n> equivalent to <rev>^1^1^1. See below for an illustration of the usage\n> of this form.\n>\n> Would it be acceptable to disallow only ~<n> (<n> as [0-9]+) in a tag\n> name but allow ~[^0-9].*, i.e. if the immediately following symbol\n> after '~' is a letter, do not\n> interpret ~ as a special character. Could it work?\n\nWe could make that work, with some caveats:\n\n 1) The syntax we've reserved for refnames is quite small, and my bias\n    at least would be to say you should just make a tag like\n    rpkg-util-1.4-rc1 instead (as e.g. git.git and linux.git do).\n\n    Carving out an exception like this also means we couldn't use\n    ~[^0-9].* for anything magical in the future.\n\n    But I think that's a rather small objection, we have other syntax\n    escape hatches, and we're unlikely to use ~[^0-9].* as some new\n    magic.\n\n 2) If we patch git to accept this, you'll be creating refs that aren't\n    inter-operable with previous versions of git.\n\n    This is a big deal. E.g. you'll happily create this special ref,\n    then try to push it to github, and they'll croak because that's an\n    invalid ref to them. Ditto some co-worker of yours who's using an\n    older version of git.\n\n    FWIW if you manually create such a tag e.g. for-each-ref will emit\n    'warning: ignoring ref with broken name' and just not show it.\n\n>>\n>> etc.\n>>\n>> Although I guess git could learn to disambiguate that form from the tag\n>> you're trying to create.\n>>\n>>> git tag rpkg-util-1.4%rc1\n>>>\n>>> but percentage sign does not seem to be particular fitting for\n>>> pre-release marking.\n>>>\n>>> Thank you\n>>> clime\n"},{"id":"341536","messageId":"CANT8FXSN7-fD7YCqr=asraG-ttupiJfrzhCNaW86-RQ4m05Rbw@mail.gmail.com","threadId":"48029","inReplyTo":"87zi3cp9rp.fsf@evledraar.gmail.com","subject":"Re: allow \"~\" to be present in a tag name","fromName":"Michal Novotny","fromEmail":"clime@redhat.com","sentAt":"2018-03-13T11:35:08Z","receivedAt":"2018-03-13T11:35:15Z","isPatch":false,"sender":{"key":"clime@redhat.com","avatar":null},"body":"On Tue, Mar 13, 2018 at 11:09 AM, Ævar Arnfjörð Bjarmason\n<avarab@gmail.com> wrote:\n>\n> On Tue, Mar 13 2018, Michal Novotny jotted:\n>\n>> On Tue, Mar 13, 2018 at 10:07 AM, Ævar Arnfjörð Bjarmason\n>> <avarab@gmail.com> wrote:\n>>>\n>>> On Tue, Mar 13 2018, Michal Novotny jotted:\n>>>\n>>>> Hello,\n>>>>\n>>>> currently, if I try to create a tag that has tilde \"~\"  in name, an\n>>>> error is raised. E.g.\n>>>>\n>>>> $ git tag rpkg-util-1.4~rc1\n>>>> fatal: 'rpkg-util-1.4~rc1' is not a valid tag name.\n>>>>\n>>>> Now, actually it would be very cool if tilde was allowed in a tag name\n>>>> because we would like to use it for tagging pre-releases of (not-only\n>>>> rpm) packages.\n>>>>\n>>>> Is there some deep technical reason why tilde cannot be present in a\n>>>> tag name? I tried that e.g.\n>>>\n>>> Yes, because a trailing tilde is part of git's rev syntax, see \"man\n>>> git-rev-parse\", or try in any repo:\n>>>\n>>>     git show HEAD\n>>>     git show HEAD~2\n>>>     git show HEAD^~2\n>>\n>> Right, reading the man pages:\n>>\n>> <rev>~<n>, e.g. master~3\n>>            A suffix ~<n> to a revision parameter means the commit\n>> object that is the <n>th generation ancestor of the named commit\n>> object, following only the first\n>>            parents. I.e.  <rev>~3 is equivalent to <rev>^^^ which is\n>> equivalent to <rev>^1^1^1. See below for an illustration of the usage\n>> of this form.\n>>\n>> Would it be acceptable to disallow only ~<n> (<n> as [0-9]+) in a tag\n>> name but allow ~[^0-9].*, i.e. if the immediately following symbol\n>> after '~' is a letter, do not\n>> interpret ~ as a special character. Could it work?\n>\n> We could make that work, with some caveats:\n>\n>  1) The syntax we've reserved for refnames is quite small, and my bias\n>     at least would be to say you should just make a tag like\n>     rpkg-util-1.4-rc1 instead (as e.g. git.git and linux.git do).\n\nThere is kind of clash of symbolics with rpm world. In rpm world, the component\nafter the last dash in a package full (versioned) name is usually\nreserved for a downstream\npackager who increments it as he/she adds patches to the original\nsources. I will\nneed to do slightly more research here of what is possible.\n\nThank you so far!\n\n>\n>     Carving out an exception like this also means we couldn't use\n>     ~[^0-9].* for anything magical in the future.\n>\n>     But I think that's a rather small objection, we have other syntax\n>     escape hatches, and we're unlikely to use ~[^0-9].* as some new\n>     magic.\n>\n>  2) If we patch git to accept this, you'll be creating refs that aren't\n>     inter-operable with previous versions of git.\n>\n>     This is a big deal. E.g. you'll happily create this special ref,\n>     then try to push it to github, and they'll croak because that's an\n>     invalid ref to them. Ditto some co-worker of yours who's using an\n>     older version of git.\n>\n>     FWIW if you manually create such a tag e.g. for-each-ref will emit\n>     'warning: ignoring ref with broken name' and just not show it.\n>\n>>>\n>>> etc.\n>>>\n>>> Although I guess git could learn to disambiguate that form from the tag\n>>> you're trying to create.\n>>>\n>>>> git tag rpkg-util-1.4%rc1\n>>>>\n>>>> but percentage sign does not seem to be particular fitting for\n>>>> pre-release marking.\n>>>>\n>>>> Thank you\n>>>> clime\n"},{"id":"341607","messageId":"20180314000742.GD147135@aiede.svl.corp.google.com","threadId":"48029","inReplyTo":"CANT8FXTF41-4zvqvrEek262D8OZRhA4nsiPguyNTL9mwF1+mkg@mail.gmail.com","subject":"Re: allow \"~\" to be present in a tag name","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2018-03-14T00:07:43Z","receivedAt":"2018-03-14T00:07:50Z","isPatch":false,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Hi Michal,\n\nMichal Novotny wrote:\n\n> currently, if I try to create a tag that has tilde \"~\"  in name, an\n> error is raised. E.g.\n>\n> $ git tag rpkg-util-1.4~rc1\n> fatal: 'rpkg-util-1.4~rc1' is not a valid tag name.\n\nAs Ævar mentioned, this is disallowed to prevent a collision with\nGit's revision specifying syntax.\n\nWhile I'm sympathetic to wanting the tag name to match the version\nnumber used by the package manager, the line has to be drawn\nsomewhere.  \"git help check-ref-format\" describes the current\nnamespace:\n\n\tGit imposes the following rules on how references are named:\n\n\t1. They can include slash / for hierarchical (directory)\n\t   grouping, but no slash-separated component can begin with a\n\t   dot . or end with the sequence .lock.\n\n\t2. They must contain at least one /. This enforces the\n\t   presence of a category like heads/, tags/ etc. but the\n\t   actual names are not restricted. If the --allow-onelevel\n\t   option is used, this rule is waived.\n\n\t3. They cannot have two consecutive dots .. anywhere.\n\n\t4. They cannot have ASCII control characters (i.e. bytes whose\n\t   values are lower than \\040, or \\177 DEL), space, tilde ~,\n\t   caret ^, or colon : anywhere.\n\n\t5. They cannot have question-mark ?, asterisk *, or open\n\t   bracket [ anywhere. See the --refspec-pattern option below\n\t   for an exception to this rule.\n\n\t6. They cannot begin or end with a slash / or contain multiple\n\t   consecutive slashes (see the --normalize option below for\n\t   an exception to this rule)\n\n\t7. They cannot end with a dot ..\n\n\t8. They cannot contain a sequence @{.\n\n\t9. They cannot be the single character @.\n\n       10. They cannot contain a \\.\n\nIf anything, I suspect the current namespace is too wide.  For\nexample, it has issues with Unicode normalization in filenames on some\nplatforms, and it allows some potentially problematic characters like\n` and |.\n\nSo my first instinct is to recommend that you apply some mapping\nbetween your packager manager's version syntax and Git's tag syntax\n--- e.g. using -rc1 as Ævar suggested, or using urlencoding %7Erc1 as\nyou hinted.\n\nThat isn't to say that this would be impossible to loosen.  But my\nworry is that it's hard to decide where to draw the line: there are a\nnumber of sets of names that might want to be valid tags, and it is\nhard to say which are worth the complexity of expanding the set of\nvalid ref names.  That's why my first reaction is to look around for\nanother way to accomplish your goal.\n\nThanks,\nJonathan\n"},{"id":"341737","messageId":"87po45enr3.fsf@evledraar.gmail.com","threadId":"48029","inReplyTo":"87zi3cp9rp.fsf@evledraar.gmail.com","subject":"Re: allow \"~\" to be present in a tag name","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2018-03-15T08:39:28Z","receivedAt":"2018-03-15T08:39:44Z","isPatch":false,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"\nOn Tue, Mar 13 2018, Ævar Arnfjörð Bjarmason jotted:\n\n> On Tue, Mar 13 2018, Michal Novotny jotted:\n>\n>> On Tue, Mar 13, 2018 at 10:07 AM, Ævar Arnfjörð Bjarmason\n>> <avarab@gmail.com> wrote:\n>>>\n>>> On Tue, Mar 13 2018, Michal Novotny jotted:\n>>>\n>>>> Hello,\n>>>>\n>>>> currently, if I try to create a tag that has tilde \"~\"  in name, an\n>>>> error is raised. E.g.\n>>>>\n>>>> $ git tag rpkg-util-1.4~rc1\n>>>> fatal: 'rpkg-util-1.4~rc1' is not a valid tag name.\n>>>>\n>>>> Now, actually it would be very cool if tilde was allowed in a tag name\n>>>> because we would like to use it for tagging pre-releases of (not-only\n>>>> rpm) packages.\n>>>>\n>>>> Is there some deep technical reason why tilde cannot be present in a\n>>>> tag name? I tried that e.g.\n>>>\n>>> Yes, because a trailing tilde is part of git's rev syntax, see \"man\n>>> git-rev-parse\", or try in any repo:\n>>>\n>>>     git show HEAD\n>>>     git show HEAD~2\n>>>     git show HEAD^~2\n>>\n>> Right, reading the man pages:\n>>\n>> <rev>~<n>, e.g. master~3\n>>            A suffix ~<n> to a revision parameter means the commit\n>> object that is the <n>th generation ancestor of the named commit\n>> object, following only the first\n>>            parents. I.e.  <rev>~3 is equivalent to <rev>^^^ which is\n>> equivalent to <rev>^1^1^1. See below for an illustration of the usage\n>> of this form.\n>>\n>> Would it be acceptable to disallow only ~<n> (<n> as [0-9]+) in a tag\n>> name but allow ~[^0-9].*, i.e. if the immediately following symbol\n>> after '~' is a letter, do not\n>> interpret ~ as a special character. Could it work?\n>\n> We could make that work, with some caveats:\n>\n>  1) The syntax we've reserved for refnames is quite small, and my bias\n>     at least would be to say you should just make a tag like\n>     rpkg-util-1.4-rc1 instead (as e.g. git.git and linux.git do).\n>\n>     Carving out an exception like this also means we couldn't use\n>     ~[^0-9].* for anything magical in the future.\n>\n>     But I think that's a rather small objection, we have other syntax\n>     escape hatches, and we're unlikely to use ~[^0-9].* as some new\n>     magic.\n>\n>  2) If we patch git to accept this, you'll be creating refs that aren't\n>     inter-operable with previous versions of git.\n>\n>     This is a big deal. E.g. you'll happily create this special ref,\n>     then try to push it to github, and they'll croak because that's an\n>     invalid ref to them. Ditto some co-worker of yours who's using an\n>     older version of git.\n>\n>     FWIW if you manually create such a tag e.g. for-each-ref will emit\n>     'warning: ignoring ref with broken name' and just not show it.\n\nNot to beat this dead horse, but just for the list archive: FWIW there's\nother commands that'll just plain die if they find such a ref, e.g. git\ngc:\n\n    fatal: bad object refs/tags/foo~rc1\n    error: failed to run repack\n\nSo if we ever expand the scope of allowed refs we'd need to first adjust\nthe setting and then wait a long time, least downgrading git hard break\nsome commands.\n\n>>>\n>>> etc.\n>>>\n>>> Although I guess git could learn to disambiguate that form from the tag\n>>> you're trying to create.\n>>>\n>>>> git tag rpkg-util-1.4%rc1\n>>>>\n>>>> but percentage sign does not seem to be particular fitting for\n>>>> pre-release marking.\n>>>>\n>>>> Thank you\n>>>> clime\n"}]}