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

Re: [RFC PATCH v3 8/8] --sparse for porcelains

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Aug 17, 2009, 22:02 UTC
Message-ID
<alpine.DEB.1.00.0908172347220.8306@pacific.mpi-cbg.de>
In-Reply-To
<7vws52uvxq.fsf@alter.siamese.dyndns.org>
Hi,
On Mon, 17 Aug 2009, Junio C Hamano wrote:
Show 13 quoted lines
> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> 
> > However, my illustration of the scenario was only to one end, namely 
> > to convince all of you that assume-changed != sparse.
> >
> > And maybe to the end to explain that sparse checkout could help this 
> > guy.
> 
> How?  If sparse is _not to check it out_, then that is not what the 
> person is doing either.  It feels to me that you are suggesting an 
> inappropriate hack to replace another inappropriate hack, suggesting to 
> use a hacksaw because an earlier attempt to use a hammer did not quite 
> work to drive the screw in.
Not exactly.

What does "sparse checkout" mean, really? It means that Git should only check out a part of the tracked files, and not even so much as look outside. It means to me that everything outside of that focus is clearly to be handled as all the other untracked data.

And here comes the problem: if something is treated untracked because it was outside of the sparse checkout, then I want it to be treated as untracked _even if_ I happened to broaden the checkout by editing .git/info/sparse. The file did not just magically become subject to overwriting just because I edited .git/info/sparse (which could be a simple mistake). So the index _needs_ to know that the sparse'd-out attribute is something completely different from the assume-unchanged attribute, even if Git should _handle_ the files with those attributes pretty similar _most_ of the time.

> I never said assume-unchanged _is_ sparse.  You cannot mark an index 
> entry that does not exist, obviously you need more (either the earlier 
> "hook that tells what should/shouldn't exist", or "the pattern").
Right.
Show 8 quoted lines
> But I think the work-tree semantics you need to _implement_ sparse 
> matches what you would want from assume-unchanged.  Not the original, 
> draconian one that updates the work tree by saying "you promised me you 
> wouldn't change them", but the updated one that tells git to pretend 
> that the local change is not there but still keep the local 
> modification, including deletion.  The work-tree "local changes" sparse 
> makes is a small subset of possible local changes assume-unchanged would 
> need to support.  It only deletes work tree files.

As I tried to convince you already, it is not wise to mix up the two meanings. They _are_ different: in one case, we _have_ a file, and we even _expect_ the file to actually have the same contents as what is recorded in the index. In the other case, we do _not_ have a file, so we do _not_ even expect the file to have the same contents.

In fact, in the latter case (the sparse case) we do not want to look for the file; not for the reason that we expect the contents to be the same anyway, but because we expect it not even to be there!

So while the _technical_ side is pretty much the same (most of the time, I illustrated a corner case, it it is very easy to think of other corner cases that might even be inadvertent, all the more reason to protect the user) -- don't look for the file -- the _semantics_ are _very_ different.

And you see that they are different when all of a sudden you cannot take the _absence_ of the file as the indicator for "assume-unchanged" and "sparse".

In fact, with the semantics implied by the label 'assume-unchanged', it could well be argued that making the file _absent_ (for the sparse checkout) is a dirty trick. This is not what "assume that the file is unchanged" implies at all.

So let's just keep the semantics utterly simple and stupid, and have an
- assumed-unchanged bit, which assumes that a file is there, but that the 
  contents need not to be checked for performance reasons, and
- a no-checkout bit, which assumes that the user never checked out that 
  file (if it exists, it comes from somewhere else, and needs to be 
  protected like untracked files that would be overwritten by a branch 
  switch).
I hope this explanation was clear.

Ciao, Dscho

Previous: Junio C HamanoNext: skillzero@gmail.com
Message 29 of 53 in “Sparse checkout”
  1. 0/8 Sparse checkoutNguyễn Thái Ngọc Duy, Aug 11, 2009
  2. 1/8 Prevent diff machinery from examining assume-unchanged entries on worktreeNguyễn Thái Ngọc Duy, Aug 11, 2009
  3. 2/8 Avoid writing to buffer in add_excludes_from_file_1()Nguyễn Thái Ngọc Duy, Aug 11, 2009
  4. 3/8 Read .gitignore from index if it is assume-unchangedNguyễn Thái Ngọc Duy, Aug 11, 2009
  5. 4/8 excluded_1(): support exclude "directories" in indexNguyễn Thái Ngọc Duy, Aug 11, 2009
  6. 5/8 dir.c: export excluded_1() and add_excludes_from_file_1()Nguyễn Thái Ngọc Duy, Aug 11, 2009
  7. 6/8 unpack-trees.c: generalize verify_* functionsNguyễn Thái Ngọc Duy, Aug 11, 2009
  8. 7/8 Support sparse checkout in unpack_trees() and read-treeNguyễn Thái Ngọc Duy, Aug 11, 2009
  9. 8/8 --sparse for porcelainsNguyễn Thái Ngọc Duy, Aug 11, 2009
  10. Junio C HamanoAug 12, 2009
  11. Nguyen Thai Ngoc DuyAug 12, 2009
  12. Nguyen Thai Ngoc DuyAug 13, 2009
  13. Jakub NarebskiAug 13, 2009
  14. Nguyen Thai Ngoc DuyAug 13, 2009
  15. Jakub NarebskiAug 14, 2009
  16. Junio C HamanoAug 15, 2009
  17. Jakub NarebskiAug 15, 2009
  18. Johannes SchindelinAug 16, 2009
  19. Johannes SchindelinAug 17, 2009
  20. Nguyen Thai Ngoc DuyAug 17, 2009
  21. Johannes SchindelinAug 17, 2009
  22. Nguyen Thai Ngoc DuyAug 17, 2009
  23. Johannes SchindelinAug 17, 2009
  24. Nguyen Thai Ngoc DuyAug 17, 2009
  25. Junio C HamanoAug 17, 2009
  26. Nguyen Thai Ngoc DuyAug 17, 2009
  27. Johannes SchindelinAug 17, 2009
  28. Junio C HamanoAug 17, 2009
  29. Johannes SchindelinAug 17, 2009
  30. skillzero@gmail.comAug 17, 2009
  31. Johannes SchindelinAug 17, 2009
  32. Jakub NarebskiAug 18, 2009
  33. skillzero@gmail.comAug 18, 2009
  34. Nguyen Thai Ngoc DuyAug 18, 2009
  35. git find (was: [RFC PATCH v3 8/8] --sparse for porcelains)Jakub Narebski, Aug 18, 2009
  36. Nguyen Thai Ngoc DuyAug 18, 2009
  37. Jakub NarebskiAug 18, 2009
  38. Jakub NarebskiAug 18, 2009
  39. skillzero@gmail.comAug 18, 2009
  40. Junio C HamanoAug 17, 2009
  41. Johannes SchindelinAug 17, 2009
  42. Jakub NarebskiAug 17, 2009
  43. Johannes SixtAug 12, 2009
  44. Nguyen Thai Ngoc DuyAug 12, 2009
  45. Raja R HarinathAug 12, 2009
  46. Johannes SixtAug 13, 2009
  47. skillzero@gmail.comAug 11, 2009
  48. Jakub NarebskiAug 11, 2009
  49. skillzero@gmail.comAug 11, 2009
  50. Nguyen Thai Ngoc DuyAug 12, 2009
  51. skillzero@gmail.comAug 12, 2009
  52. Junio C HamanoAug 12, 2009
  53. Nguyen Thai Ngoc DuyAug 13, 2009

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.