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

Re: [PATCH 2/2] git-gc: skip stashes when expiring reflogs

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 15, 2008, 05:07 UTC
Message-ID
<7vabhne15k.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<612BAE20-8DF3-4323-8AEF-527B92122A7A@wincent.com>
しらいしななこ  <nanako3@bluebottle.com> writes:
> I apologize for my lack of perfect foresight as the original
> author of the command.  As I already said, I think expiration
> period of reflogs that is configurable for each ref as suggested
> earlier by Junio makes sense.
You do not need to be overly apologetic.

It's not your fault that the way you originally scratched your own itch is already 90% useful to others in different context of theirs but with 10% "caveat emptor". Others owe kudos to you for what they're given, and the way for them to thank you would be to scratch their own itch by filling the remaining 10% to make it work better in their context, not by bitching and quibbling on what the dictionary definition of the word "stash" is.

Show 15 quoted lines
> But changing the default expiration "never" for stash has its
> own problem and I think we need to modify the way a stash entry
> is created to solve it.
> ...
> If you do not expire stash forever, you will keep the history
> behind the commit H.  This is unnecessary and is problematic
> particularly if you rebase your branches frequently.
>
> In order to apply a stash, all you need is the tree of the three
> commits contained in this structure.  You do not need the
> history behind commit H.
>
> The following is a trial patch to change how a stash is recorded.
> With this patch I do not think we will keep unnecessary commits
> behind H in the repository even when a stash is kept forever.

Keeping stashes indefinitely is a relatively easy change (even though there may need design discussions on the cleanest way to do so) but nobody so far seemed to have thought about the ramifications of doing so. I am glad somebody is thinking one step ahead, and I think what you raised is a valid concern. Crufts from rebases will usually be purged from repository thanks to reflog autoexpiration, but if somebody keeps a stash that was made on a commit that has long been rebased away, it will keep the rebased commits pinned to the repository, and we are talking about indefinite retention here. People should get worried.

I suspect this won't be a huge issue, but the only reason behind that suspicion is because I expect people won't have insane number of rebases nor keep insane number of stash entries, so the extra cruft that is kept behind the stash entries won't be insanely large. But people are known to be insane enough to break my expectations, so I'd say we should make things safer before we make the change to keep stashes forever by default.

I think the steps from here on would be:
 - Apply the patch in your message I am responding to, so that a stash
   that is kept forever will not pin the unnecessary history behind it in
   the repository.  As you said there is no reason to make the base commit
   (H) actually the same as the commit in the true history --- the only
   thing we care about it is its tree object;
 - Design and decide the way to tell git to make stash entries unexpirable
   (or maybe have very long expiration period).  I am leaning toward a
   configuration option that lets you specify expiration period per ref,
   rather than marking individual reflog entries as I suggested earlier;
 - Make the default for new repositories' stash reflog expiry period
   "never", by setting the above configuration upon "git init".

None of the above should obviously be in 1.5.6, but I think even the third step to the change the default would be acceptable in the next 1.6.0 release.

Previous: しらいしななこNext: Eric Raible
Message 20 of 69 in “git-gc: skip stashes when expiring reflogs”
  1. 2/2 git-gc: skip stashes when expiring reflogsBrandon Casey, Jun 11, 2008
  2. Mike HommeyJun 11, 2008
  3. Johannes SchindelinJun 11, 2008
  4. Jeff KingJun 11, 2008
  5. Nicolas PitreJun 11, 2008
  6. Eric RaibleJun 12, 2008
  7. Wincent ColaiutaJun 12, 2008
  8. Nicolas PitreJun 12, 2008
  9. Junio C HamanoJun 12, 2008
  10. Eric RaibleJun 12, 2008
  11. Junio C HamanoJun 12, 2008
  12. Eric RaibleJun 12, 2008
  13. Johannes SchindelinJun 13, 2008
  14. Wincent ColaiutaJun 13, 2008
  15. Jeff KingJun 13, 2008
  16. Johannes SchindelinJun 13, 2008
  17. Christian JaegerJun 13, 2008
  18. Wincent ColaiutaJun 14, 2008
  19. しらいしななこJun 14, 2008
  20. Junio C HamanoJun 15, 2008
  21. Eric RaibleJun 16, 2008
  22. Junio C HamanoJun 16, 2008
  23. Johannes SchindelinJun 17, 2008
  24. Junio C HamanoJun 17, 2008
  25. Johannes SchindelinJun 18, 2008
  26. Junio C HamanoJun 18, 2008
  27. Brandon CaseyJun 16, 2008
  28. Jakub NarebskiJun 16, 2008
  29. Mikael MagnussonJun 13, 2008
  30. Brandon CaseyJun 12, 2008
  31. Junio C HamanoJun 12, 2008
  32. Brandon CaseyJun 12, 2008
  33. しらいしななこJun 13, 2008
  34. Andreas EricssonJun 13, 2008
  35. Jeff KingJun 13, 2008
  36. Andreas EricssonJun 13, 2008
  37. Jeff KingJun 13, 2008
  38. Andreas EricssonJun 13, 2008
  39. Jakub NarebskiJun 13, 2008
  40. Sverre RabbelierJun 13, 2008
  41. Jeff KingJun 13, 2008
  42. Miles BaderJun 13, 2008
  43. Junio C HamanoJun 13, 2008
  44. Jakub NarebskiJun 13, 2008
  45. Sverre RabbelierJun 13, 2008
  46. Olivier MarinJun 13, 2008
  47. Junio C HamanoJun 13, 2008
  48. Wincent ColaiutaJun 13, 2008
  49. Brandon CaseyJun 13, 2008
  50. Olivier MarinJun 13, 2008
  51. しらいしななこJun 14, 2008
  52. Wincent ColaiutaJun 13, 2008
  53. Jeff KingJun 13, 2008
  54. Olivier MarinJun 13, 2008
  55. Jon LoeligerJun 13, 2008
  56. Brandon CaseyJun 13, 2008
  57. Brandon CaseyJun 11, 2008
  58. Jeff KingJun 12, 2008
  59. Brandon CaseyJun 12, 2008
  60. Jeff KingJun 13, 2008
  61. Wincent ColaiutaJun 13, 2008
  62. Sverre RabbelierJun 13, 2008
  63. Teemu LikonenJun 13, 2008
  64. Jeff KingJun 13, 2008
  65. Miles BaderJun 13, 2008
  66. Brandon CaseyJun 13, 2008
  67. Jeff KingJun 13, 2008
  68. Brandon CaseyJun 11, 2008
  69. Johannes SchindelinJun 15, 2008

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.