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

Re: [PATCH v2 0/1] Make 'git commit' not accidentally lose staged content

From
Duy Nguyen <pclouds@gmail.com>
Date
Sep 19, 2018, 16:12 UTC
Message-ID
<CACsJy8A3QCYY6QeJQYkbCKYh=7Q7pj=rer_OQHLGoAMqTNomNA@mail.gmail.com>
In-Reply-To
<20180918231903.GA30695@sigill.intra.peff.net>
On Wed, Sep 19, 2018 at 1:19 AM Jeff King <peff@peff.net> wrote:
Show 18 quoted lines
>
> On Tue, Sep 18, 2018 at 12:36:06PM -0700, Jacob Keller wrote:
>
> > > I like that, too. It's a little more costly just because it may involve
> > > object-db writes, but I think in most cases it would be fine. I almost
> > > always "git stash" away discarded changes these days instead of "git
> > > reset --hard", because it effectively provides this kind of log.
> >
> > Obviously we do eventually turn the index into a tree, which is used
> > by the commit. Would it be possible to simply somehow store these
> > trees, and have commands which blow the tree away simply instead, save
> > it? I'm not sure how costly that is.
>
> For an up-to-date index with the cache-tree extension, this should be
> pretty cheap.  Even for a partially-staged index, where we already have
> the blob in the object database, it should just incur the tree
> computation (and parts you didn't touch would hopefully have an
> up-to-date cache-tree).

Just FYI. I wanted to get at least pruning support in place before posting another RFC. But right now I'm going without cache-tree. Whenever a file is updated, the _blob_ hashes are recorded in the index log (one line per update, same as reflog format) and the description part of the line is the updated path.

This is simpler to do, and we can still reconstruct a tree/commit in memory if we need to (but not whole tree snapshots; but I don't think that would be very useful). But maybe cache-tree approach is better. We will see.

-- 
Duy
Previous: Jeff KingNext: Jeff King
Message 23 of 28 in “commit: new option to abort -a something is already staged”
  1. commit: new option to abort -a something is already stagedNguyễn Thái Ngọc Duy, Aug 20, 2018
  2. Junio C HamanoAug 20, 2018
  3. Eric SunshineAug 20, 2018
  4. Jonathan NiederAug 20, 2018
  5. Duy NguyenAug 21, 2018
  6. Jonathan NiederAug 23, 2018
  7. Jonathan NiederAug 23, 2018
  8. Duy NguyenAug 23, 2018
  9. Junio C HamanoAug 23, 2018
  10. Jacob KellerAug 24, 2018
  11. Duy NguyenAug 24, 2018
  12. Jacob KellerAug 24, 2018
  13. Jacob KellerAug 24, 2018
  14. 0/1 Make 'git commit' not accidentally lose staged contentNguyễn Thái Ngọc Duy, Sep 16, 2018
  15. 1/1 commit: do not clobber the indexNguyễn Thái Ngọc Duy, Sep 16, 2018
  16. Junio C HamanoSep 17, 2018
  17. Duy NguyenSep 17, 2018
  18. Jeff KingSep 17, 2018
  19. Duy NguyenSep 17, 2018
  20. Jeff KingSep 18, 2018
  21. Jacob KellerSep 18, 2018
  22. Jeff KingSep 18, 2018
  23. Duy NguyenSep 19, 2018
  24. Jeff KingSep 19, 2018
  25. Junio C HamanoSep 17, 2018
  26. Jacob KellerSep 18, 2018
  27. Eckhard MaaßSep 18, 2018
  28. Jacob KellerSep 18, 2018

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.