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

Re: Change in .gitignore handling: intended or bug?

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 10, 2016, 00:59 UTC
Message-ID
<xmqq60wvf8qm.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<xmqqd1r3f9rc.fsf@gitster.mtv.corp.google.com>
Junio C Hamano <gitster@pobox.com> writes:
Show 17 quoted lines
> Duy Nguyen <pclouds@gmail.com> writes:
>
>> A bit off topic, but these two paragraphs may need rephrasing, I don't
>> really understand what it's trying to say
>>
>>  - If the pattern does not contain a slash '/', Git treats it as
>>    a shell glob pattern and checks for a match against the
>>    pathname relative to the location of the `.gitignore` file
>>    (relative to the toplevel of the work tree if not from a
>>    `.gitignore` file).
>>
>> Not sure why "relative to the location of .gitignore file" matters. We
>> basically just take `basename $path` out and try to match it.
>
> That is because the documentation was written with ...
> matches, even though '*.c' does not match 'd/hello.c' in the shell
> glob sense,...

Sorry, this does not make much sense, as d/e/hello.c would still match '*.c' in d/.gitignore. So it is a straight-forward match against the basename, and there is nothing relative to the location of .gitignore. If anything, relative to where the pattern is found should be relevant to a pattern _with_ slash in it.

I should have been more careful and thought things through, but as this was an "off topic" comment, I didn't. Sorry about that.

In any case, back to "on topic" part again; I couldn't come up with a better rewrite using named rules (partly because you need to clearly define each rule before referring them, and some of the rules are temporary workarounds for the 2.8 regression that will hopefully disappear in near future). I think you understand the bug and the limitation of the current code a lot better than I do, so if you can please send a final version of the documentation update in the coming 18 hours (I have an option of using what is already queued on 'pu' as a fall-back-good-enough version but I want to keep the last-resort option as that--if I know a potential source of a better version, I'd choose to ask first ;-).

Thanks.
Previous: Junio C HamanoNext: Duy Nguyen
Message 27 of 28 in “Change in .gitignore handling: intended or bug?”
  1. Charles StrahanMar 4, 2016
  2. Duy NguyenMar 4, 2016
  3. Kevin DaudtMar 4, 2016
  4. Charles StrahanMar 4, 2016
  5. Kevin DaudtMar 4, 2016
  6. Duy NguyenMar 4, 2016
  7. Junio C HamanoMar 4, 2016
  8. Junio C HamanoMar 4, 2016
  9. Duy NguyenMar 5, 2016
  10. Duy NguyenMar 5, 2016
  11. Charles StrahanMar 5, 2016
  12. Junio C HamanoMar 5, 2016
  13. Junio C HamanoMar 7, 2016
  14. Junio C HamanoMar 8, 2016
  15. Duy NguyenMar 8, 2016
  16. Junio C HamanoMar 8, 2016
  17. Duy NguyenMar 9, 2016
  18. Junio C HamanoMar 9, 2016
  19. Junio C HamanoMar 9, 2016
  20. dir.c: fix dir re-inclusion rules with "NODIR" and "MUSTBEDIR"Nguyễn Thái Ngọc Duy, Mar 9, 2016
  21. Junio C HamanoMar 9, 2016
  22. Duy NguyenMar 10, 2016
  23. Duy NguyenMar 9, 2016
  24. Junio C HamanoMar 9, 2016
  25. Duy NguyenMar 10, 2016
  26. Junio C HamanoMar 10, 2016
  27. Junio C HamanoMar 10, 2016
  28. Duy NguyenMar 10, 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.