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

Re: Question about 'branch -d' safety

From
Julian Phillips <julian@quantumfyre.co.uk>
Date
Jul 11, 2010, 08:48 UTC
Message-ID
<7414fff60758b3f60d69a1bbed49165e@212.159.54.234>
In-Reply-To
<201007110916.29567.jnareb@gmail.com>

On Sun, 11 Jul 2010 09:16:26 +0200, Jakub Narebski <jnareb@gmail.com> wrote:

Show 5 quoted lines
> Dnia niedziela 11. lipca 2010 08:55, Clemens Buchacher napisał:
>> On Sat, Jul 10, 2010 at 02:57:35PM -0700, Jakub Narebski wrote:
>> > 
>> > It's unfortunately not so easy.  The problem you have to solve is D/F
>> > conflict: if you have 'foo/bar' branch, you can't create 'foo'
branch,
Show 14 quoted lines
>> > but after deleting 'foo/bar' you want to be able to create 'foo'
>> > branch and reflog for 'foo' branch.
>> 
>> I'm going to read up on Jonathan's pointers. But I do not really
>> see the problem above. If the reflog already exists, the new branch
>> simpliy continues using it. So if the branch is re-created, it's as
>> if the branch had never been deleted.
> 
> The problem is, that when you have 'foo/bar' branch, then you have
> 'foo/bar' reflog.  When you delete branch 'foo/bar', but do not delete
> 'foo/bar' reflog (only add to it branch deletion event), and then you
> want to create 'foo' branch, git wouldn't be able to create reflog
> fo 'foo' because of directory / file (D/F) conflict: there is 'foo/'
> directory preventing file 'foo' from being created.

You could just change the reflog code so that if foo is a directory it looks for/creates foo/.reflog (the dot is to prevent a clash with a valid branch name)?

>> Or possibly we add a special reflog entry which points the branch
>> to a zero sha to signify that the branch had been deleted.
> 
> That is a good idea anyway.
-- 
Julian
Previous: Jakub NarebskiNext: Clemens Buchacher
Message 12 of 42 in “Question about 'branch -d' safety”
  1. Nanako ShiraishiDec 29, 2009
  2. Nicolas SebrechtDec 29, 2009
  3. Nanako ShiraishiDec 30, 2009
  4. Junio C HamanoDec 30, 2009
  5. Nicolas SebrechtDec 30, 2009
  6. Clemens BuchacherJul 10, 2010
  7. Jonathan NiederJul 10, 2010
  8. Jakub NarebskiJul 10, 2010
  9. Jonathan NiederJul 10, 2010
  10. Clemens BuchacherJul 11, 2010
  11. Jakub NarebskiJul 11, 2010
  12. Julian PhillipsJul 11, 2010
  13. Clemens BuchacherJul 11, 2010
  14. Junio C HamanoJul 11, 2010
  15. Jakub NarebskiJul 11, 2010
  16. Will PalmerJul 11, 2010
  17. Clemens BuchacherJul 12, 2010
  18. Junio C HamanoJul 12, 2010
  19. Clemens BuchacherJul 13, 2010
  20. Will PalmerJul 13, 2010
  21. Johannes SixtJul 13, 2010
  22. Will PalmerJul 13, 2010
  23. Clemens BuchacherJul 13, 2010
  24. Clemens BuchacherJul 17, 2010
  25. Jonathan NiederJul 18, 2010
  26. Jakub NarebskiJul 18, 2010
  27. Will PalmerJul 18, 2010
  28. Jakub NarebskiJul 18, 2010
  29. Will PalmerJul 19, 2010
  30. Jakub NarebskiJul 19, 2010
  31. Joshua JensenJul 19, 2010
  32. Clemens BuchacherJul 19, 2010
  33. Will PalmerJul 19, 2010
  34. Jakub NarebskiJul 19, 2010
  35. Joshua JensenJul 20, 2010
  36. Will PalmerJul 20, 2010
  37. Jakub NarebskiJul 19, 2010
  38. Junio C HamanoJul 19, 2010
  39. Clemens BuchacherJul 19, 2010
  40. Jakub NarebskiJul 19, 2010
  41. Ævar Arnfjörð BjarmasonJul 20, 2010
  42. Matthieu MoyJul 20, 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.