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

Re: [RFC PATCH 00/12] Sparse checkout

From
Jakub Narebski <jnareb@gmail.com>
Date
Jul 24, 2008, 09:35 UTC
Message-ID
<m3tzefvd3q.fsf@localhost.localdomain>
In-Reply-To
<20080723145518.GA29035@laptop>
Nguyễn Thái Ngọc Duy <pclouds@gmail.com> writes:
Show 18 quoted lines
> I have not looked at non-builtin commands yet, but I think it's not
> a big deal. We have several rounds before this series is good enough ;)
> So in short, sparse prefix will be stored in config, core.sparsecheckout.
> you have three new commands to enter/update/leave sparse checkout:
> 
> git clone --path=prefix       # clone with sparse checkout
> git checkout --path=prefix    # limit/update checkout paths
> git checkout --full           # stop sparse checkout
> 
> Other operations should be normal. User attempts to do anything outside
> sparse checkout will get flagged. Git itself should not touch anything
> outside sparse checkout.
> 
> One more thing. As files outside sparse checkout will not be checking
> out, .gitignore and .gitattributes from parent directories (outside
> sparse checkout) will be gone too. This may lead to surprise.
> 
> Comments are welcome.

A note: my comments here reflects what I have remember from reading comments in this thread; I have not examined the code, though.

First, I think that 'sparse checkout' is a better idea than former 'subtree (partial) checkout'; and I guess it could be easier to code.

Second, I think you can simply special case .git* files (.gitignore, .gitattributes, .gitmodules), and always check them out for all intermediate directories (unless configured otherwise, of course). So for example if you have the following directory structure:

  A/.gitignore
  A/a
  A/B1/.gitignore
  A/B1/b
  A/B2/.gitignore
  A/B2/c

and you are checking out only subdirectory 'B1' (and all files in it; if subdirectories are checked out recursively it depends on configuration), and if for example there is .gitignore in every directory, then checked out tree would look like this:

  A/.gitignore
  A/B1/.gitignore
  A/B1/b

The ability to do this is one of advantages of 'sparse' checkout over 'subtree' checkout.

Third, about the place where to store information about which paths are checked out, and which are not. There are three possible places to store this information:

  1. repository configuration, e.g. `core.sparsecheckout' variable
     (multivalued?), like for `core.worktree'
  2. some text file in $GIT_DIR, e.g. '.git/sparse', like for shallow
     clone ("git clone --depth <depth>") it is grafts-like
     $GIT_DIR/shallow (see Documentation/technical/shallow.txt).
  3. in the index itseld ($GIT_DIR/index), as proposed by Johannes
     Schindelin.

While I do think that some information about sparseness should be in the index, for git to be able to commit from the index for example, I don't think it is a good place as the only/main place to store information about which paths are checked out; I think that because IMVHO git commands should survive hosing (removing) index file.

Just my 2 eurocents.
-- 
Jakub Narebski
Poland
ShadeHawk on #git
Previous: James PickensNext: Nguyen Thai Ngoc Duy
Message 22 of 27 in “Sparse checkout”
  1. 00/12 Sparse checkoutNguyễn Thái Ngọc Duy, Jul 23, 2008
  2. Nguyen Thai Ngoc DuyJul 23, 2008
  3. Johannes SchindelinJul 23, 2008
  4. Nguyen Thai Ngoc DuyJul 23, 2008
  5. Johannes SchindelinJul 23, 2008
  6. Nguyen Thai Ngoc DuyJul 24, 2008
  7. Johannes SchindelinJul 24, 2008
  8. Nguyen Thai Ngoc DuyJul 24, 2008
  9. Johannes SchindelinJul 24, 2008
  10. Nguyen Thai Ngoc DuyJul 24, 2008
  11. Avery PennarunJul 24, 2008
  12. Johannes SchindelinJul 24, 2008
  13. Nguyen Thai Ngoc DuyJul 24, 2008
  14. Jan HudecAug 3, 2008
  15. Johannes SchindelinAug 3, 2008
  16. Nguyen Thai Ngoc DuyAug 4, 2008
  17. James PickensJul 24, 2008
  18. Nguyen Thai Ngoc DuyJul 24, 2008
  19. James PickensJul 24, 2008
  20. Nguyen Thai Ngoc DuyJul 24, 2008
  21. James PickensJul 24, 2008
  22. Jakub NarebskiJul 24, 2008
  23. Nguyen Thai Ngoc DuyJul 24, 2008
  24. Jakub NarebskiJul 24, 2008
  25. Nguyen Thai Ngoc DuyJul 24, 2008
  26. Avery PennarunJul 25, 2008
  27. Johannes SchindelinJul 25, 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.