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

Re: [PATCH 3/2] dir.c: fix dir re-inclusion rules with "NODIR" and "MUSTBEDIR"

From
Duy Nguyen <pclouds@gmail.com>
Date
Mar 18, 2016, 05:40 UTC
Message-ID
<CACsJy8A2FKn-8nWtK4QPMHDCDYvTZBrQs1RVMApnuejXQis19g@mail.gmail.com>
In-Reply-To
<56EB8961.70302@fb.com>
On Fri, Mar 18, 2016 at 11:51 AM, Durham Goode <durham@fb.com> wrote:
Show 30 quoted lines
> On 3/17/16 4:49 PM, Junio C Hamano wrote:
>>
>> Thanks for these 5 patches, two of which need to be discarded ;-).
>> I think you can pick either one of 1/2, pick the one that says
>> "non-NULL" (as opposed to "something") in the log message for 2/2.
>>
>> Durham, does it fix your issues if you apply the 1/2 and 2/2 (but
>> not 3/2) on top of 2.8-rc?
>>
>> Duy, how comfortable are you with the idea of including this two in
>> 2.8 final?  We have long passed the final -rc, and while it is
>> probably OK to prolong the cycle and do another -rc, we cannot keep
>> going like "oops, there is another thing discovered by somebod new"
>> forever.
>>
>> Thanks.
>
> Patches 1+2 fix the repro steps in the report, yes.  But I've found another
> case that produces different results in 2.8 than in 2.7:
>
> Given a repo with files:
>
> dir1/dir2/show/file
> dir1/dir2/hide/file
>
> and a sparse-checkout of
>
> /*
> /dir1/dir2/show
> !/dir1/dir2/

I would say this is "undefined behavior" patterns. The intention of "!" pattern is to revert a subset of a matched pattern, e.g. !/dir1/dir2/show/something. Combining lines 2 and 3 together, "!dir1/dir2/" is not only supposed to revert dir1/dir2/show entirely, but extend the reversion outside of it. At least to me that's not intended.

Skipping that tricky pair, the pairs "/*" and "!/dir1/dir2/" means "exclude everything except dir1/dir2" (in .gitignore sense) or "include everything except dir1/dir2" in sparse checkout sense. Which results in empty worktree. 1+2 trips when the trailing slash in the last rule exists and includes both files in show/hide. Patch 3/2 fixes the tripping and exclude both. If the last rule is "!/dir1/dir2" then 1+2 results in empty worktree as well.

If I swap the last two rules, then it behaves the way we expect, dir1/dir2/show stays, dir1/dir2/hide is gone (again, the trailing "/" in !dir1/dir2/ requires patch 3/2).

v2.7.3 differs in the way "!" is handled. It does extend reversion outside dir1/dir2/show, back to dir1/dir2. While 2.8+1+2 recognizes and follows the "/*" and "!dir1/dir2/" pair.

The way I interpreted the rules above, though, may be because I'm just trying to defend the current code. Junio, your call on whether to revert this whole patch series.

Show 5 quoted lines
> the working copy still contains dir1/dir2/hide/file when run from 2.8.0-rc2.
> In git 2.6 and 2.7.3 it does not show up (which is the expected behavior,
> from what I understand of the docs).  Repro script is below.  Notice, the
> 'dir2/' part of the paths is important.  If I drop that directory, the issue
> doesn't repro.
-- 
Duy
Previous: Durham GoodeNext: Durham Goode
Message 22 of 30 in “bug: sparse config interpretation incorrectness in 2.8.0-rc2”
  1. Durham GoodeMar 17, 2016
  2. Duy NguyenMar 17, 2016
  3. Durham GoodeMar 17, 2016
  4. Junio C HamanoMar 17, 2016
  5. Duy NguyenMar 17, 2016
  6. Johannes SchindelinMar 17, 2016
  7. Duy NguyenMar 17, 2016
  8. Johannes SchindelinMar 17, 2016
  9. Duy NguyenMar 17, 2016
  10. Johannes SchindelinMar 18, 2016
  11. Junio C HamanoMar 17, 2016
  12. Durham GoodeMar 17, 2016
  13. 1/2 dir.c: fix bug in 'nd/exclusion-regression-fix' topicNguyễn Thái Ngọc Duy, Mar 17, 2016
  14. 1/2 dir.c: fix bug in 'nd/exclusion-regression-fix' topicNguyễn Thái Ngọc Duy, Mar 17, 2016
  15. 3/2 dir.c: fix dir re-inclusion rules with "NODIR" and "MUSTBEDIR"Nguyễn Thái Ngọc Duy, Mar 17, 2016
  16. Junio C HamanoMar 17, 2016
  17. Duy NguyenMar 18, 2016
  18. Junio C HamanoMar 18, 2016
  19. Duy NguyenMar 18, 2016
  20. Eric SunshineMar 18, 2016
  21. Durham GoodeMar 18, 2016
  22. Duy NguyenMar 18, 2016
  23. Durham GoodeMar 18, 2016
  24. Duy NguyenMar 18, 2016
  25. Junio C HamanoMar 18, 2016
  26. Extending this cycle by a week and reverting !reinclusion topicJunio C Hamano, Mar 18, 2016
  27. Duy NguyenMar 19, 2016
  28. 2/2 dir.c: correct "stuck" logging logicNguyễn Thái Ngọc Duy, Mar 17, 2016
  29. 2/2 dir.c: correct "stuck" logging logicNguyễn Thái Ngọc Duy, Mar 17, 2016
  30. Junio C HamanoMar 18, 2016

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.