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

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

From
Michael Haggerty <mhagger@alum.mit.edu>
Date
Jun 1, 2013, 03:00 UTC
Message-ID
<51A963B7.6060002@alum.mit.edu>
In-Reply-To
<CAMK1S_jY1tDCkyOamX8XNW9g8Dzf6yN9znwN6he-EVcOkBM1fQ@mail.gmail.com>
On 06/01/2013 03:31 AM, Sitaram Chamarty wrote:
> Is there a way to prevent reflog deletion when the branch is deleted?
> The last entry could simply be a line where the second SHA is all 0's.

This is a known problem. The technical reason that this is not trivial to solve is the possibility of a directory/file conflict between old reflog files and references that might be created subsequently (which in turn is a limitation of how loose references and reflogs are mapped to filenames):

    git branch foo
    git branch -d foo
    git branch foo/bar

Under your proposal, the second line would retain the reflog file for foo, which is named ".git/logs/refs/heads/foo". But the third line wants to create a file ".git/logs/refs/heads/foo/bar". The existence of the "foo" file prevents the creation of a "foo" directory.

A similar problem exists if "foo" and "foo/bar" are exchanged in the above example.

Peff proposed a solution to this problem [1], but AFAIK it is not making progress.

Michael

[1] http://thread.gmane.org/gmane.comp.version-control.git/201715/focus=201752

-- 
Michael Haggerty
mhagger@alum.mit.edu
http://softwareswirl.blogspot.com/
Previous: Sitaram ChamartyNext: Jeff King
Message 2 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.