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

Re: [PATCH nd/attr-match-optim-more 2/2] attr: more matching optimizations from .gitignore

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 9, 2012, 16:40 UTC
Message-ID
<7vhaq3ha4r.fsf@alter.siamese.dyndns.org>
In-Reply-To
<7vvcekgn0h.fsf@alter.siamese.dyndns.org>
Junio C Hamano <gitster@pobox.com> writes:
Show 35 quoted lines
> Johannes Sixt <j.sixt@viscovery.net> writes:
>
>> Am 10/9/2012 7:08, schrieb Junio C Hamano:
>>> Imagine if we allowed only one attribute per line, instead of
>>> multiple attributes on one line.
>>>     
>>>  - If you want to unset the attribute, you would write "path -attr".
>>> 
>>>  - If you want to reset the attribute to unspecified, you would
>>>    write "path !attr".
>>> 
>>> Both are used in conjunction with some other (typically more
>>> generic) pattern that sets, sets to a value, and/or unsets the
>>> attribute, to countermand its effect.
>>> 
>>> If you were to allow "!path attr", what does it mean?  It obviously
>>> is not about setting the attr to true or to a string value, but is
>>> it countermanding an earlier set and telling us to unset the attr,
>>> or make the attr unspecified?
>>
>> If I have at the toplevel:
>>
>>   *.txt  whitespace=tabwidth=4
>>
>> and in a subdirectory
>>
>>   *.txt  whitespace=tabwidth=8
>>   !README.txt
>>
>> it could be interpreted as "do not apply *.txt to REAME.txt in this
>> subdirectory". That is, it does not countermand some _particular_
>> attribute setting, but says "use the attributes collected elsewhere".
>
> It makes it unclear what "elsewhere" means, though (besides, it does
> not match the way the matching logic works at all).

Ignoring the current implementation, I find the suggested semantics somewhat intriguing. It is something we may want to look into in the future.

Previous: Junio C HamanoNext: Nguyễn Thái Ngọc Duy
Message 6 of 14 in “gitignore: make pattern parsing code a separate function”
  1. 1/2 gitignore: make pattern parsing code a separate functionNguyễn Thái Ngọc Duy, Oct 9, 2012
  2. 2/2 attr: more matching optimizations from .gitignoreNguyễn Thái Ngọc Duy, Oct 9, 2012
  3. Junio C HamanoOct 9, 2012
  4. Johannes SixtOct 9, 2012
  5. Junio C HamanoOct 9, 2012
  6. Junio C HamanoOct 9, 2012
  7. 2/2 attr: more matching optimizations from .gitignoreNguyễn Thái Ngọc Duy, Oct 10, 2012
  8. Junio C HamanoOct 10, 2012
  9. Nguyen Thai Ngoc DuyOct 12, 2012
  10. Junio C HamanoOct 10, 2012
  11. Junio C HamanoOct 10, 2012
  12. Nguyen Thai Ngoc DuyOct 11, 2012
  13. Junio C HamanoOct 12, 2012
  14. Nguyen Thai Ngoc DuyOct 13, 2012

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.