Re: Git 1.7.6: Sparse checkouts do not work with directory exclusions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Sep 20, 2011 at 8:03 AM, Joshua Jensen
<jjensen@xxxxxxxxxxxxxxxxx> wrote:
> Sometime after Git 1.7.3.2, sparse checkouts stopped working for me.  My
> sparse-checkout file looks something like:
>
> *
> !DirA/
> !DirB/
> DirC/
>
> I have restored some lines of code that were removed in November 2010.  This
> resolves the sparse checkout issue for me, but my guess is the solution is
> not implemented properly.
>
> Can anyone confirm the issue

Confirmed. It got me wonder why the negated pattern tests did not
catch this. Turns out this works:

/*
!DirA/
!DirB/
DirC

This is my theory why yours does not work: negated patterns !DirA and
!DirB excludes both directories, but git still descends in them
because you may have other patterns that re-include parts of
DirA/DirB, for example:

DirA/DirD
!DirA

When it's in DirA/DirB, "*" tells git to match everything (equivalent
"DirA/*" and "DirB/*"), so it matches all entries in DirA/DirB again,
essentially reverting "!DirA" and "!DirB" effects.

By using "/*" instead of "*", we tell git to just match entries at top
level, not all levels.

I think it makes sense, but it's a bit tricky.

> and describe why those lines were removed?

Quotes from 9e08273: "The commit provided a workaround for matching
directories in index. But it is no longer needed."
-- 
Duy
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]