Re: What's cooking in git.git (Oct 2009, #04; Wed, 21)
- From
- skillzero@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.