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

Re: [RFC/PATCH] refs: tone down the dwimmery in refname_match() for {heads,tags,remotes}/*

From
Paolo Bonzini <pbonzini@redhat.com>
Date
May 27, 2019, 12:33 UTC
Message-ID
<5c9ce55c-2c3a-fce0-d6e3-dfe5f8fc9b01@redhat.com>
In-Reply-To
<20190526225445.21618-1-avarab@gmail.com>
On 27/05/19 00:54, Ævar Arnfjörð Bjarmason wrote:
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 "tags/for-linus" branch in their "kvm"
> repository, except because they happened to have an existing
> "refs/tags/for-linus" reference we pushed there instead, and replaced
> an annotated tag with a lightweight tag.

Actually, I would not be surprised even if "git push foo someref:tags/foo" _always_ created a lightweight tag (i.e. push to refs/tags/foo).

In my opinion, the bug is that "git request-pull" should warn if the tag is lightweight remotely but not locally, and possibly even vice versa. Here is a simple testcase:

  # setup "local" repo
  mkdir -p testdir/a
  cd testdir/a
  git init
  echo a > test
  git add test
  git commit -minitial
  # setup "remote" repo
  git clone --bare . ../b
  # setup "local" tag
  echo b >> test
  git commit -msecond test
  git tag -mtag tag1
  # create remote lightweight tag and prepare a pull request
  git push ../b HEAD:refs/tags/tag1
  git request-pull HEAD^ ../b tags/tag1
Paolo
Previous: Ævar Arnfjörð BjarmasonNext: Ævar Arnfjörð Bjarmason
Message 3 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.