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

Re: [PATCH 3/3] reset.c: update files when using sparse to avoid data loss.

From
Duy Nguyen <pclouds@gmail.com>
Date
Apr 17, 2017, 12:09 UTC
Message-ID
<CACsJy8Bb_maecm2ywHuyMXhORXZBMxMzmtdX_YgCq_DVfwy+Dw@mail.gmail.com>
In-Reply-To
<CACsJy8CbxGPeWHgR8s-ix_wxPODvisw6eaLnEUV4LDmoeXt5BQ@mail.gmail.com>
On Sun, Apr 16, 2017 at 11:25 AM, Duy Nguyen <pclouds@gmail.com> wrote:
Show 5 quoted lines
>> Because this is a reset --mixed it will never run through unpack_trees and
>> The entries are never marked with CE_REMOVE.
>
> I know. But in my view, it should. All updates from a tree object to
> the index should happen through unpack_trees().

Just fyi. My view is wrong. We need to handle a diff here, not through unpack_trees() because "git reset --mixed" support partial reset, see 2ce633b928 (git-reset [--mixed] <tree> [--] <paths>... - 2006-12-14). We might be able to make unpack_trees() leave certain paths(pec) untouched, but I don't think it is worth it. In other words, your original patch is the way to go.

PS. I briefly wondered if "git checkout <tree> -- <pathspec>" had the same problem. I think not, because while --mixed does not touch worktree, checkout does, so it should restore on-disk versions if needed. The read_tree_some() call in checkout_paths() should respect sparse patterns and add skip-worktree bits back if needed though, but I don't think it does that.

-- 
Duy
Previous: Duy NguyenNext: Stefan Beller
Message 14 of 16 in “fix working directory file issues while using sparse-checkout”
  1. 0/3 fix working directory file issues while using sparse-checkoutKevin Willford, Apr 7, 2017
  2. 1/3 merge-recursive.c: conflict using sparse should update fileKevin Willford, Apr 7, 2017
  3. Duy NguyenApr 10, 2017
  4. 2/3 apply.c: do not checkout file when skip-worktree bit setKevin Willford, Apr 7, 2017
  5. Stefan BellerApr 7, 2017
  6. Duy NguyenApr 10, 2017
  7. 3/3 reset.c: update files when using sparse to avoid data loss.Kevin Willford, Apr 7, 2017
  8. Stefan BellerApr 7, 2017
  9. Duy NguyenApr 10, 2017
  10. Kevin WillfordApr 11, 2017
  11. Duy NguyenApr 12, 2017
  12. Kevin WillfordApr 12, 2017
  13. Duy NguyenApr 16, 2017
  14. Duy NguyenApr 17, 2017
  15. Stefan BellerApr 7, 2017
  16. Stefan BellerApr 7, 2017

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.