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

Re: can we prevent reflog deletion when branch is deleted?

From
Jeff King <peff@peff.net>
Date
Nov 14, 2013, 08:14 UTC
Message-ID
<20131114081456.GC16327@sigill.intra.peff.net>
In-Reply-To
<528416EA.1070307@gmail.com>
On Thu, Nov 14, 2013 at 05:48:50AM +0530, Sitaram Chamarty wrote:
> Is there *any* way we can preserve a reflog for a deleted branch,
> perhaps under logs/refs/deleted/<timestamp>/full/ref/name ?
I had patches to do something like this here:
  http://thread.gmane.org/gmane.comp.version-control.git/201715/focus=201752

but there were definitely some buggy corners, as much of the code assumed you needed to have a ref to have a reflog. I don't even run with it locally anymore.

At GitHub, we log each change to an "audit log" in addition to the regular reflog (we also stuff extra data from the environment into the reflog message). So even after a branch is deleted, its audit log entries remain, though you have to pull out the data by hand (git doesn't know about it at all, except as an append-only sink for writing). And git doesn't use the audit log for connectivity, either, so eventually the objects could be pruned.

> Just some basic protection -- don't delete the reflog, and instead,
> rename it to something that preserves the name but in a different
> namespace.

That part is easy. Accessing it seamlessly and handling reflog expiration are a little harder. Not because they're intractable, but just because there are some low-level assumptions in the git code. The patch series I mentioned above mostly works. It probably just needs somebody to go through and find the corner cases.

-Peff
Previous: Sitaram ChamartyNext: Stephen Bash
Message 18 of 21 in “can we prevent reflog deletion when branch is deleted?”
  1. Sitaram ChamartyJun 1, 2013
  2. Michael HaggertyJun 1, 2013
  3. Jeff KingJun 1, 2013
  4. Ramkumar RamachandraJun 1, 2013
  5. Jeff KingJun 1, 2013
  6. Ramkumar RamachandraJun 1, 2013
  7. Sitaram ChamartyJun 1, 2013
  8. Ramkumar RamachandraJun 1, 2013
  9. Sitaram ChamartyJun 2, 2013
  10. Sitaram ChamartyNov 14, 2013
  11. Thomas RastNov 14, 2013
  12. Jeff KingNov 14, 2013
  13. Sitaram ChamartyNov 14, 2013
  14. Jeff KingNov 14, 2013
  15. Luca MilanesioNov 14, 2013
  16. Sitaram ChamartyNov 14, 2013
  17. Sitaram ChamartyNov 14, 2013
  18. Jeff KingNov 14, 2013
  19. Stephen BashNov 14, 2013
  20. Sitaram ChamartyNov 14, 2013
  21. Sitaram ChamartyNov 14, 2013

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.