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

Re: What's cooking in git.git (Oct 2009, #04; Wed, 21)

From
Sskillzero@gmail.com <skillzero@gmail.com>
Date
Oct 22, 2009, 15:31 UTC
Message-ID
<2729632a0910220831x4b67021eg772abc8b751ef7e5@mail.gmail.com>
In-Reply-To
<fcaeb9bf0910220415v69c22ed9o4ab85b8858fbf187@mail.gmail.com>
On Thu, Oct 22, 2009 at 4:15 AM, Nguyen Thai Ngoc Duy <pclouds@gmail.com> wrote:
Show 28 quoted lines
> On Thu, Oct 22, 2009 at 3:46 PM, Jakub Narebski <jnareb@gmail.com> wrote:
>> Junio C Hamano <gitster@pobox.com> writes:
>>> * nd/sparse (2009-08-20) 19 commits.
>>>  - sparse checkout: inhibit empty worktree
>>>  - Add tests for sparse checkout
>>>  - read-tree: add --no-sparse-checkout to disable sparse checkout support
>>>  - unpack-trees(): ignore worktree check outside checkout area
>>>  - unpack_trees(): apply $GIT_DIR/info/sparse-checkout to the final index
>>>  - unpack-trees(): "enable" sparse checkout and load $GIT_DIR/info/sparse-checkout
>>>  - unpack-trees.c: generalize verify_* functions
>>>  - unpack-trees(): add CE_WT_REMOVE to remove on worktree alone
>>>  - Introduce "sparse checkout"
>>>  - dir.c: export excluded_1() and add_excludes_from_file_1()
>>>  - excluded_1(): support exclude files in index
>>>  - unpack-trees(): carry skip-worktree bit over in merged_entry()
>>>  - Read .gitignore from index if it is skip-worktree
>>>  - Avoid writing to buffer in add_excludes_from_file_1()
>>>  - Teach Git to respect skip-worktree bit (writing part)
>>>  - Teach Git to respect skip-worktree bit (reading part)
>>>  - Introduce "skip-worktree" bit in index, teach Git to get/set this bit
>>>  - Add test-index-version
>>>  - update-index: refactor mark_valid() in preparation for new options
>>
>> Hmmm... what is happening with that series?
>
> Junio concerned about CE_MATCH_IGNORE_VALID being used by both
> assume-unchanged and skip-worktree bits, which I did not resolve yet.
> I should really get back to the series when I have time.

Just an FYI, but I've been using this series for a while. I'm actually relying on sparse support in our internal build system (via my private build with this series) so I hope it doesn't go away :) I haven't really noticed any problems (I thought the index state got out of sync once, but I couldn't reproduce the problem later). Here's some feedback though:

1. I found it confusing to have to append '/' to directories in the
sparse pattern list for directories. I always forget it requires them.
It would be nice to support the same rules as .gitignore in terms of
'/'.
2. It would be nice to have built-in support for a sparse modules file
and switching between them. Maybe .gitmodules could support "module"
or "sparsemodule" sections to list the patterns for that sparse
module. I've written a simple script to do this and it's what I use.
It just parses the INI-style file:
[module "MyProject"]
	App1
	Shared1
	!FolderIDontWant

Then I have a "module" script to read that file for a specified module and switch to it:

git module switch MyProject

The script just parses `git show HEAD:.gitmodules` (so it works without a working directory) and switches sparse modules by enabling sparse, writing info/sparse-checkout, and doing a checkout:

sub cmd_switch
{
	# Enable sparse.
	my $currentCmd = "git config core.sparsecheckout true";
	system( $currentCmd ) == 0 or die( "error: $currentCmd\n" );
	
	# Write sparse patterns.
	my $gitDir = `git rev-parse --git-dir`;
	chop( $gitDir );
	my $sparsePath = $gitDir . "/info/sparse-checkout";
	if( $? != 0 ) { die( "error: read git directory failed $?\n" ); }
	open( FILE, ">", $sparsePath ) or die( "error: can't open '$sparsePath'\n" );
	foreach( @{$gModules->{$gModuleName}} )
	{
		print( FILE "$_\n" );
	}
	close( FILE );
	
	# Checkout using new sparse patterns.
	system( "git checkout" ) == 0 or die( "error: switch module failed\n" );
}

That said, the current level of sparse support provided by this series is good enough for me because I can build my own scripts like this on top of it to automate things.

Previous: Nguyen Thai Ngoc DuyNext: Junio C Hamano
Message 9 of 33 in “What's cooking in git.git (Oct 2009, #04; Wed, 21)”
  1. Junio C HamanoOct 22, 2009
  2. ks/precompute-completion (was Re: What's cooking in git.git (Oct 2009, #04; Wed, 21))Stephen Boyd, Oct 22, 2009
  3. Sverre RabbelierOct 22, 2009
  4. Stephen BoydOct 22, 2009
  5. A Large Angry SCMOct 22, 2009
  6. Johannes SchindelinOct 22, 2009
  7. Jakub NarebskiOct 22, 2009
  8. Nguyen Thai Ngoc DuyOct 22, 2009
  9. skillzero@gmail.comOct 22, 2009
  10. Junio C HamanoOct 22, 2009
  11. Stephen BoydOct 22, 2009
  12. Junio C HamanoOct 24, 2009
  13. add tests for git diff --submoduleJens Lehmann, Oct 23, 2009
  14. Junio C HamanoOct 24, 2009
  15. Clemens BuchacherOct 25, 2009
  16. Junio C HamanoOct 26, 2009
  17. Clemens BuchacherOct 26, 2009
  18. Stephen BoydOct 26, 2009
  19. Clemens BuchacherOct 26, 2009
  20. Shawn O. PearceOct 27, 2009
  21. Junio C HamanoOct 28, 2009
  22. Shawn O. PearceOct 27, 2009
  23. Shawn O. PearceOct 28, 2009
  24. A Large Angry SCMOct 22, 2009
  25. Sverre RabbelierOct 23, 2009
  26. Junio C HamanoOct 23, 2009
  27. Sverre RabbelierOct 23, 2009
  28. Junio C HamanoOct 23, 2009
  29. Sverre RabbelierOct 23, 2009
  30. Jakub NarebskiOct 23, 2009
  31. Sverre RabbelierOct 23, 2009
  32. A Large Angry SCMOct 23, 2009
  33. Sverre RabbelierOct 23, 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.