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

Re: [PATCH] push: make "HEAD:tags/my-tag" consistently push to a branch

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 21, 2019, 16:05 UTC
Message-ID
<xmqq4l4ily9l.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<20190621144447.21769-1-avarab@gmail.com>
Ævar Arnfjörð Bjarmason  <avarab@gmail.com> writes:
Show 8 quoted lines
> This resulted in a case[1] where someone on LKML did:
>
>     git push kvm +HEAD:tags/for-linus
>
> Which would have created a new "refs/heads/tags/for-linus" branch in
> their "kvm" repository. But since they happened to have an existing
> "refs/tags/for-linus" reference we pushed there instead, and replaced
> an annotated tag with a lightweight tag.

I do not think that is a problematic behaviour in the context of asking Linus to pull when every time a merge window opens. One would keep refs/tags/for-linus at the publishing site, and update it (forcing as necessary) before request-pull. If it went to a branch with confusing name tags/for-linus, that would be a disaster.

Show 14 quoted lines
> Now we'll print out the following advice when this happens, and act
> differently as described therein:
>
>     hint: The <dst> part of the refspec matched both of:
>     hint:
>     hint:   1. tags/my-tag -> refs/tags/my-tag
>     hint:   2. tags/my-tag -> refs/heads/tags/my-tag
>     hint:
>     hint: Earlier versions of git would have picked (1) as the RHS starts
>     hint: with a second-level ref prefix which could be fully-qualified by
>     hint: adding 'refs/' in front of it. We now pick (2) which uses the prefix
>     hint: inferred from the <src> part of the refspec.
>     hint:
>     hint: See the "<refspec>..." rules  discussed in 'git help push'.

"matched" in past tense means that your example scenario actually has such a confusing branch? Then I think the above is OK (or just silently updating the branch is also fine, I think). If there were no such branch currently, the above woudl be a serious regression, but as long as both exist, I think it is probably OK. From my quick scan of your new tests, I couldn't quite tell if that case (i.e. the a tag "my-tag" exists but a bbranch "tags/my-tag"does not exist at the receiving end when push happens, and the tag is updated without touching the branch nor giving extra warnings and hints) is covered, though.

Thanks.
Previous: Ævar Arnfjörð Bjarmason
Message 8 of 8 in “Re: [GIT PULL] KVM changes for Linux 5.2-rc2”
  1. Linus TorvaldsMay 26, 2019
  2. refs: tone down the dwimmery in refname_match() for {heads,tags,remotes}/*Ævar Arnfjörð Bjarmason, May 26, 2019
  3. Paolo BonziniMay 27, 2019
  4. Ævar Arnfjörð BjarmasonMay 27, 2019
  5. Junio C HamanoMay 27, 2019
  6. Paolo BonziniMay 27, 2019
  7. push: make "HEAD:tags/my-tag" consistently push to a branchÆvar Arnfjörð Bjarmason, Jun 21, 2019
  8. Junio C HamanoJun 21, 2019

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.