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

Re: Deleting the "current" branch in remote bare repositories

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 8, 2009, 19:05 UTC
Message-ID
<7v8wogzr3v.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<20090208111838.GD14359@coredump.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 18 quoted lines
> On Sun, Feb 08, 2009 at 01:42:07AM -0800, Junio C Hamano wrote:
>
>> I think forbidding the removal of the current branch falls into the same
>> category as forbidding the updating of the current branch.  It is what you
>> would want to avoid in many workflows, and receive.denyDeleteCurrent that
>> defaults to refuse may eventually be a good way to do this, but we need a
>> transition plan for that escape hatch.  Most people may not see why they
>> would want to do such a thing, and many people may perceive that in *their
>> own* workflow such an operation can only be a mistake, but that is not a
>> good enough reason to suddenly start forbidding something other people
>> were allowed to do so far.
>
> I thought of that, too, but note that receive.denyDeleteCurrent is about
> preventing mistakes in a _non-bare_ repo. But deleting the HEAD branch
> is also annoying in a bare repo (but not _as_ annoying; the real impact
> is that cloners get a "could not checkout" message, but you don't have
> the weird index-and-HEAD don't sync issue that non-bare repos get).
> Should such a safety valve apply to both?

If you remove the current branch from a repository, the impact that operation causes the remote users of the repository would be the same whether the repository has or does not have a work tree. And in that sense, I think it should apply equally. The criteria is not "is it bare", but "is it used by people remotely". IOW, you refuse deletion of the current branch if other people may fetch from it.

In addition, removing the current branch will affect local operations in the repository --- the person who were working in the work tree to prepare for the _next_ commit will now end up creating a root commit. The effect is similar, as you correctly point out, to the issue of the HEAD and the work tree going out of sync that ends up creating a commit with a lot of reverts. They both cause the user on the work tree to create an undesired commit. Here, the criteria is "does this have a work tree". I think the current receive.denyCurrentBranch should also trigger in this case.

Previous: Jeff KingNext: Junio C Hamano
Message 7 of 29 in “Deleting the "current" branch in remote bare repositories”
  1. Jan KrügerFeb 7, 2009
  2. Felipe ContrerasFeb 7, 2009
  3. Jan KrügerFeb 8, 2009
  4. Jeff KingFeb 8, 2009
  5. Junio C HamanoFeb 8, 2009
  6. Jeff KingFeb 8, 2009
  7. Junio C HamanoFeb 8, 2009
  8. 0/6 Deleting the "current" branch in a remote repositoryJunio C Hamano, Feb 9, 2009
  9. 1/6 builtin-receive-pack.c: do not initialize statics to 0Junio C Hamano, Feb 9, 2009
  10. 2/6 t5400: allow individual tests to failJunio C Hamano, Feb 9, 2009
  11. 3/6 receive-pack: receive.denyDeleteCurrentJunio C Hamano, Feb 9, 2009
  12. 4/6 remote prune: warn dangling symrefsJunio C Hamano, Feb 9, 2009
  13. 5/6 Warn use of "origin" when remotes/origin/HEAD is danglingJunio C Hamano, Feb 9, 2009
  14. 6/6 receive-pack: default receive.denyDeleteCurrent to refuseJunio C Hamano, Feb 9, 2009
  15. Jeff KingFeb 9, 2009
  16. Junio C HamanoFeb 11, 2009
  17. Jeff KingFeb 11, 2009
  18. Jeff KingFeb 11, 2009
  19. Jeff KingFeb 9, 2009
  20. Jeff KingFeb 9, 2009
  21. Junio C HamanoFeb 9, 2009
  22. Jeff KingFeb 10, 2009
  23. Junio C HamanoFeb 10, 2009
  24. Jeff KingFeb 9, 2009
  25. Junio C HamanoFeb 9, 2009
  26. Junio C HamanoFeb 9, 2009
  27. Jeff KingFeb 10, 2009
  28. Jeff KingFeb 9, 2009
  29. Jeff KingFeb 9, 2009

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.