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

Re: [PATCH] Support pathspec magic :(exclude) and its short form :-

From
Junio C Hamano <gitster@pobox.com>
Date
Nov 21, 2013, 18:43 UTC
Message-ID
<xmqqpppt4mur.fsf@gitster.dls.corp.google.com>
In-Reply-To
<CACsJy8AeL+EVZme3BPocXDfRqPpqKDA8nCuwx3buiS66L7G4fA@mail.gmail.com>
Duy Nguyen <pclouds@gmail.com> writes:
Show 8 quoted lines
> Btw I'm thinking of extending pathspec magic syntax a bit to allow
> path completion. Right now the user has to write
>
> git log -- :-Documentation
>
> which does not play well with path completion. I'm thinking of accepting
>
> git log -- :- Documentation

Please don't. That does not help our users, but actively harm them. They have to stop and wonder why a single pathspec is spelled as two tokens on the command line of some other people.

Doing that stupidity only to help those who polish the tool (namely, "bash completion") to be lazy is doubly wrong (in the meantime, the users can type your second variant and then edit the result).

For the same reason why I do not think rewriting
	echo "hello, world!"
to
	echo "hello, world-"

only to work around a pitfall of a particular tool (namely "bash") makes any sense, I do not think it makes sense to make _our_ tool inconsistent by using "!excluded" in the files (and --exclude) and "-not this pattern" only here.

Show 7 quoted lines
>>> +     if (nr_exclude == n)
>>> +             die(_("There is nothing to exclude from by :(exclude) patterns.\n"
>>> +                   "Perhaps you forgot to add either ':/' or '.' ?"));
>>
>> ;-).
>
> Hey it was originally not there,...

I am not objecting. I noticed it and was commending on it as "a nice touch" ;-)

Show 22 quoted lines
>>> +     /*
>>> +      *   #  | positive | negative | result
>>> +      * -----+----------+----------+-------
>>> +      * 1..4 |   -1     |    *     |  -1
>>> +      * 5..8 |    0     |    *     |   0
>>> +      *   9  |    1     |   -1     |   1
>>> +      *  10  |    1     |    0     |   1
>>> +      *  11  |    1     |    1     |   0
>>> +      *  12  |    1     |    2     |   0
>>> +      *  13  |    2     |   -1     |   2
>>> +      *  14  |    2     |    0     |   2
>>> +      *  15  |    2     |    1     |   0
>>> +      *  16  |    2     |    2     |  -1
>>> +      */
>>
>> Not sure what this case-table means...
>
> Sorry, because tree_entry_interesting_1() returns more than "match
> or not", we need to combine the result from positive pathspec with
> the negative one to correctly handle all_not_interesting and
> all_interesting. This table sums it up. I'll add more explanation
> in the next patch.

I managed to have guessed what the three columns on the right meant; I was wondering about the meaning of the "#" column and where it is defined/explained.

Previous: Duy NguyenNext: Toralf Förster
Message 15 of 16 in “RFC: git bisect should accept "paths-to-be-excluded"”
  1. Toralf FörsterSep 16, 2013
  2. Christian CouderSep 17, 2013
  3. Matthieu MoySep 17, 2013
  4. Christian CouderSep 17, 2013
  5. Duy NguyenSep 17, 2013
  6. Junio C HamanoSep 17, 2013
  7. Piotr KrukowieckiSep 17, 2013
  8. Junio C HamanoSep 17, 2013
  9. Piotr KrukowieckiSep 17, 2013
  10. Junio C HamanoSep 17, 2013
  11. Duy NguyenSep 18, 2013
  12. Support pathspec magic :(exclude) and its short form :-Nguyễn Thái Ngọc Duy, Nov 20, 2013
  13. Junio C HamanoNov 20, 2013
  14. Duy NguyenNov 21, 2013
  15. Junio C HamanoNov 21, 2013
  16. Toralf FörsterSep 17, 2013

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.