Subject: bug: sparse config interpretation incorrectness in 2.8.0-rc2

From: Durham Goode <[email-masked]>
Date: Wed, 16 Mar 2016 17:09:23 -0700

Using git 2.8.0-rc2, given a repo with the following files:

- one/hideme
- one/donthide
- two/foo

A sparse config of:

cat > .git/info/sparse-checkout <<EOF
/*
!one/hideme
EOF

Results in a repository that only has `one/donthide` in it.  I would 
expect `two/foo`to be present as well.  This worked in 2.6, and 
bisecting it points to d589a67eceacd1cc171bbe94906ca7c9a0edd8c5 "dir.c: 
don't exclude whole dir prematurely" (author cc'd).

The script I used to repro and for bisecting is pasted below:

#!/bin/bash

set -x
rm -rf sparse-test
GIT=git

$GIT init sparse-test
cd sparse-test
$GIT config --add core.sparsecheckout true

mkdir one two
touch one/hideme
touch one/donthide
touch two/foo

$GIT add .
$GIT commit -m "initial commit"
$GIT read-tree --reset -u HEAD

mkdir .git/info
cat > .git/info/sparse-checkout <<EOF
/*
!one/hideme
EOF
$GIT read-tree --reset -u HEAD

ls -R one two
set +x
echo
echo expected: see one/donthide and two/foo
echo actual: see only one/donthide

[ -d two ] && exit 0
exit 1