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

Re: [PATCH 4/5] branch: skip commit checks when deleting symref branches

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 18, 2012, 21:34 UTC
Message-ID
<7vpq4flb1c.fsf@alter.siamese.dyndns.org>
In-Reply-To
<507FF0EF.3070702@lsrfire.ath.cx>
René Scharfe <rene.scharfe@lsrfire.ath.cx> writes:
Show 15 quoted lines
> Before a branch is deleted, we check that it points to a valid
> commit.  With -d we also check that the commit is a merged; this
> check is not done with -D.
>
> The reason for that is that commits pointed to by branches should
> never go missing; if they do then something broke and it's better
> to stop instead of adding to the mess.  And a non-merged commit
> may contain changes that are worth preserving, so we require the
> stronger option -D instead of -d to get rid of them.
>
> If a branch consists of a symref, these concerns don't apply.
> Deleting such a branch can't make a commit become unreferenced,
> so we don't need to check if it is merged, or even if it is
> actually a valid commit.  Skip them in that case.  This allows
> us to delete dangling symref branches.

Purist in me tells me that we should be using "symbolic-ref -d" to correct from such a misconfiguration, but ignoring that, the above logic makes perfect sense to me, especially together with the next change to tell what branch the symref was pointing at, which can be used by the user when the user removes such a symbolic ref by mistake.

Thanks.  Will queue all five.
Previous: René ScharfeNext: Johan Herland
Message 10 of 16 in “BUG when trying to delete symbolic refs”
  1. Johan HerlandOct 15, 2012
  2. René ScharfeOct 16, 2012
  3. refs: lock symref that is to be deleted, not its targetRené Scharfe, Oct 16, 2012
  4. Junio C HamanoOct 16, 2012
  5. René ScharfeOct 18, 2012
  6. 1/5 branch: factor out check_branch_commit()René Scharfe, Oct 18, 2012
  7. 2/5 branch: factor out delete_branch_config()René Scharfe, Oct 18, 2012
  8. 3/5 branch: delete symref branch, not its targetRené Scharfe, Oct 18, 2012
  9. 4/5 branch: skip commit checks when deleting symref branchesRené Scharfe, Oct 18, 2012
  10. Junio C HamanoOct 18, 2012
  11. 0/2 Fix remaining issue when deleting symrefsJohan Herland, Oct 21, 2012
  12. 1/2 t1400-update-ref: Add test verifying bug with symrefs in delete_ref()Johan Herland, Oct 21, 2012
  13. 2/2 Fix failure to delete a packed ref through a symrefJohan Herland, Oct 21, 2012
  14. René ScharfeOct 21, 2012
  15. Junio C HamanoOct 21, 2012
  16. 5/5 branch: show targets of deleted symrefs, not sha1sRené Scharfe, Oct 18, 2012

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.