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

Re: If you would write git from scratch now, what would you change?

From
Shawn O. Pearce <spearce@spearce.org>
Date
Nov 27, 2007, 01:48 UTC
Message-ID
<20071127014804.GJ14735@spearce.org>
In-Reply-To
<200711252248.27904.jnareb@gmail.com>
Jakub Narebski <jnareb@gmail.com> wrote:
> If you would write git from scratch now, from the beginning, without 
> concerns for backwards compatibility, what would you change, or what 
> would you want to have changed?
- Sort tree entries by name, *not* by name+type
  This has got to be my biggest gripe with Git.  I think Linus really
  screwed the pooch with this.  We've talked it over a few times
  on the list and he and I have just agreed to disagree on this.
  Ask any database person and they'll tell you how wrong the
  current tree ordering is.  Or they are nuts and don't get
  the concept of data integrity.
  Linus' excuse is that the current ordering makes working with
  the flat index faster as its just one index file.  That doesn't
  mean that the flat index file can't contain tree information.
  Like it does in say that new fangled cache-tree extension.  :-)
  This particular "design decision" has brought all sorts of bugs
  into the system, like the D/F merge conflict issues, and even one
  from Linus himself when he first introduced the submodule support.
  Lets not even talk about ugly that made things in jgit.
- Loose objects storage is difficult to work with
  The standard loose object format of DEFLATE("$type $size\0$data")
  makes it harder to work with as you need to inflate at least
  part of the object just to see what the hell it is or how big
  its final output buffer needs to be.
  It also makes it very hard to stream into a packfile if you have
  determined its not worth creating a delta for the object (or no
  suitable delta base is available).
  The new (now deprecated) loose object format that was based on
  the packfile header format simplified this and made it much
  easier to work with.
- No proper libgit
  Already been stated but we don't have a great library and we
  don't have a good way to build one right now either.  A lot of
  our internal code assumes die() will abort the process.  That's a
  very bad assumption to be making inside of a library.
- Binary packed-refs representation
  I probably wouldn't have done an ASCII based packed-refs file,
  or heck, even loose refs.  I probably would have just gone with
  a binary file that we wholesale rewrite every time there is any
  sort of ref update.
  We already do this with the index.  So every time we update a
  file path we are rewriting the entire index.  And we update
  file paths a heck of a lot more often than we update branch
  heads.  Or tags.
  But tools like for-each-ref get invoked heavily, and fast access
  to the ref database is important to overall performance.
- No GIT_OBJECT_DIRECTORY vs. GIT_DIR distinction
  This is causing problems with $GIT_DIR/objects/info/alternates
  and then try to repack repositories.  Not having the ref space of
  the alternates and/or borrowers considered during repacking can
  cause all sorts of fun breakage that may be hard to recover from.
  Plus it means you have to do funny "refs/forkee" hacks just to
  avoid pushing unnecessary objects over the wire when the other
  end is borrowing objects.
  I probably would have had the object directory unified with its
  ref database, so that they cannot be accessed individually.
All of the above is written with 20/20 hindsight and all that.

Looking back (and knowing myself well) I think the only item I would have gotten right if I had written Git from scratch is the first one above (the tree entry ordering). I probably would have done something equally "as bad" as what we have today for all of the others...

-- 
Shawn.
Previous: Nicolas PitreNext: Junio C Hamano
Message 75 of 83 in “If you would write git from scratch now, what would you change?”
  1. Jakub NarebskiNov 25, 2007
  2. Pierre HabouzitNov 25, 2007
  3. Steven WalterNov 26, 2007
  4. Junio C HamanoNov 26, 2007
  5. Adam RobenNov 26, 2007
  6. Carlos RicaNov 26, 2007
  7. Daniel BarkalowNov 26, 2007
  8. Andy ParkinsNov 26, 2007
  9. Benoit SigoureNov 26, 2007
  10. Jan HudecNov 26, 2007
  11. David KastrupNov 26, 2007
  12. Jan HudecNov 26, 2007
  13. Michael PooleNov 26, 2007
  14. Jan HudecNov 26, 2007
  15. Michael PooleNov 26, 2007
  16. Jon SmirlNov 26, 2007
  17. Andy ParkinsNov 26, 2007
  18. Marco CostalbaNov 26, 2007
  19. Shawn O. PearceNov 27, 2007
  20. Jakub NarebskiNov 27, 2007
  21. Shawn O. PearceNov 27, 2007
  22. Johannes SchindelinNov 27, 2007
  23. [RFC] git-gui USer's Survey 2007 (was: If you would write git from scratch now, what would you change?)Jakub Narebski, Nov 27, 2007
  24. Johannes SchindelinNov 28, 2007
  25. Jason SewallNov 28, 2007
  26. Jan HudecNov 28, 2007
  27. Johannes SchindelinNov 28, 2007
  28. Jan HudecNov 29, 2007
  29. Johannes SchindelinNov 29, 2007
  30. Jan HudecNov 30, 2007
  31. Marco CostalbaNov 30, 2007
  32. Shawn O. PearceDec 1, 2007
  33. Marco CostalbaDec 1, 2007
  34. Sergei OrganovNov 28, 2007
  35. Andy ParkinsNov 27, 2007
  36. Marco CostalbaNov 27, 2007
  37. Jan HudecNov 27, 2007
  38. Johannes SchindelinNov 27, 2007
  39. Andy ParkinsDec 4, 2007
  40. Jing XueNov 27, 2007
  41. Jon SmirlNov 26, 2007
  42. David KastrupNov 26, 2007
  43. Jan HudecNov 26, 2007
  44. Benoit SigoureNov 26, 2007
  45. Jan HudecNov 26, 2007
  46. Nicolas PitreNov 26, 2007
  47. David KastrupNov 26, 2007
  48. Jan HudecNov 26, 2007
  49. David KastrupNov 26, 2007
  50. Jan HudecNov 26, 2007
  51. Nicolas PitreNov 26, 2007
  52. Wincent ColaiutaNov 26, 2007
  53. Junio C HamanoNov 26, 2007
  54. Nicolas PitreNov 26, 2007
  55. Junio C HamanoNov 26, 2007
  56. Nicolas PitreNov 26, 2007
  57. Shawn O. PearceNov 27, 2007
  58. Junio C HamanoNov 27, 2007
  59. Steven GrimmNov 27, 2007
  60. Johannes SchindelinNov 26, 2007
  61. Nicolas PitreNov 26, 2007
  62. Johannes SchindelinNov 26, 2007
  63. Andreas EricssonNov 27, 2007
  64. Jakub NarebskiNov 27, 2007
  65. Dana HowNov 26, 2007
  66. Nicolas PitreNov 26, 2007
  67. Dana HowNov 26, 2007
  68. Nicolas PitreNov 26, 2007
  69. Dana HowNov 26, 2007
  70. Nicolas PitreNov 26, 2007
  71. Jakub NarebskiNov 26, 2007
  72. Dana HowNov 26, 2007
  73. Shawn O. PearceNov 27, 2007
  74. Nicolas PitreNov 27, 2007
  75. Shawn O. PearceNov 27, 2007
  76. Junio C HamanoNov 27, 2007
  77. Shawn O. PearceNov 27, 2007
  78. Jakub NarebskiNov 27, 2007
  79. C# binding, was Re: If you would write git from scratch now, what would you change?Johannes Schindelin, Nov 27, 2007
  80. Nicolas PitreNov 27, 2007
  81. Dana HowNov 27, 2007
  82. Shawn O. PearceNov 27, 2007
  83. Linus TorvaldsNov 27, 2007

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.