Subject: Re: git checkout under 1.7.6 does not properly list untracked files and aborts

From: Michael J Gruber <[email-masked]>
Date: Wed, 21 Sep 2011 09:47:54 +0200

Joshua Jensen venit, vidit, dixit 20.09.2011 20:26:
> ----- Original Message -----
> From: Michael J Gruber
> Date: 9/20/2011 9:10 AM
>> Can you provide a simple test case, such as this one:
>>
>> ---%<---
>> #!/bin/sh
>>
>> rm -Rf utest || exit 1
>> mkdir utest || exit 1
>> cd utest || exit 1
>> git init
>> echo tracked>a
>> git add a
>> git commit -m a a
>> git branch side
>> echo tracked>b
>> git add b
>> git commit -m b
>> cat b
>> git checkout side
>> cat b
>> echo untracked>b
>> cat b
>> git checkout master
>> cat b
>> ---%<---
>>
>> Does this test reproduce your problem on msysgit?
> As listed, your script produces the same results on msysGit.
> 
> It appears the issue is related to sparse checkouts:
> 
> ---%<---
> #!/bin/sh
> 
> rm -Rf utest || exit 1
> mkdir utest || exit 1
> cd utest || exit 1
> git init
> git config core.sparseCheckout true
> echo *>.git/info/sparse-checkout
> echo tracked>a
> git add a
> git commit -m a a
> git branch side
> echo tracked>b
> git add b
> git commit -m b
> cat b
> git checkout side
> cat b
> echo untracked>b
> cat b
> git checkout master
> cat b
> ---%<---
> 
> -Josh

Interesting. So, it is related to sparse, it seems, and there is also a
mistake in the documentation (which contradicts itself, btw). With your
script, since all files are requested to be checked out ('*'), none
should have skip-worktree set, and the result should be the same as with
my version. But I get this:

Initialized empty Git repository in /tmp/t/utest/.git/
[master (root-commit) 5929c8b] a
 1 files changed, 1 insertions(+), 0 deletions(-)
 create mode 100644 a
[master 60ad69e] b
 1 files changed, 1 insertions(+), 0 deletions(-)
 create mode 100644 b
tracked
Switched to branch 'side'
cat: b: No such file or directory
untracked
untracked

That is probably the same output as for you. The final "git checkout
master" errored out without doing anything and without message. I'll
send a few cleanups now, and do some bisecting and thinking later;
though there are people whose sparse-knowledge is way less sparse than
mine ;)

Michael