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

Re: [PATCH] logging branch deletion to help recovering from mistakes

From
Jeff King <peff@peff.net>
Date
Dec 7, 2010, 18:20 UTC
Message-ID
<20101207182040.GA26770@sigill.intra.peff.net>
In-Reply-To
<AANLkTimnp3xCHp_3E7ry-5OQL3PFnYh=H8PhfzMN307C@mail.gmail.com>
On Tue, Dec 07, 2010 at 10:14:19AM -0800, Shawn O. Pearce wrote:
Show 7 quoted lines
> Per check-ref-format, ref names cannot contain two dots.  We could
> archive ref logs by renaming them, $GIT_DIR/logs/refs/heads/foo
> becomes $GIT_DIR/logs/refs/heads/foo..deleted-1.  If foo is created
> and deleted again, it becomes foo..deleted-2.
> 
> This still causes problems for git reflog show / git log -g because
> they want a current ref to enumerate the log of.

That seems reasonable to me. The "reflog show" limitation is just a matter of a simple code fix, though, isn't it? Is there a good reason for this restriction to exist? And even if there is, it would be simple to special case it for ..deleted-* branches.

Show 5 quoted lines
> A different approach might be to have $GIT_DIR/logs/refs/REF_ATTIC,
> and special case that in git reflog show / git log -g.  When a
> ref is deleted, append its entire log onto REF_ATTIC, between two
> specially formatted marker lines.  When recovering a branch, copy
> out the region from the REF_ATTIC log.

That seems a lot less efficient, as we have to linearly search all of REF_ATTIC to get:

  1. the reflog for one deleted branch
  2. the list of deleted branches

Neither of those is probably particularly performance critical, but it just seems like keeping the logs in files indexed by the original ref names is a more natural fit.

-Peff
Previous: Shawn PearceNext: Shawn O. Pearce
Message 13 of 28 in “logging branch deletion to help recovering from mistakes”
  1. logging branch deletion to help recovering from mistakesJunio C Hamano, Dec 6, 2010
  2. Štěpán NěmecDec 6, 2010
  3. Andreas SchwabDec 6, 2010
  4. Nguyen Thai Ngoc DuyDec 7, 2010
  5. Junio C HamanoDec 7, 2010
  6. Nguyen Thai Ngoc DuyDec 7, 2010
  7. Michael J GruberDec 7, 2010
  8. Nguyen Thai Ngoc DuyDec 7, 2010
  9. Jakub NarebskiDec 7, 2010
  10. Nguyen Thai Ngoc DuyDec 7, 2010
  11. Jeff KingDec 7, 2010
  12. Shawn PearceDec 7, 2010
  13. Jeff KingDec 7, 2010
  14. Shawn O. PearceDec 7, 2010
  15. Jeff KingDec 7, 2010
  16. Shawn O. PearceDec 7, 2010
  17. Jeff KingDec 7, 2010
  18. Shawn O. PearceDec 7, 2010
  19. Junio C HamanoDec 7, 2010
  20. Jeff KingDec 7, 2010
  21. Casey DahlinDec 7, 2010
  22. Jonathan NiederDec 7, 2010
  23. Casey DahlinDec 7, 2010
  24. Jonathan NiederDec 7, 2010
  25. Casey DahlinDec 7, 2010
  26. Junio C HamanoDec 7, 2010
  27. Jonathan NiederDec 7, 2010
  28. Jeff KingDec 7, 2010

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.