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

Re: Fwd: Possibly nicer pathspec syntax?

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 8, 2017, 03:12 UTC
Message-ID
<xmqqa89xxtnd.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<CA+55aFwPLtuPciN1o_03CwkKqFWgZd_br9Q14qyr7a7N7mxTeA@mail.gmail.com>
Linus Torvalds <torvalds@linux-foundation.org> writes:
Show 11 quoted lines
> No. The thing is, "git diff" is relative too - for path
> specifications. And the negative entries are pathspecs - and they act
> as relative ones.
>
> IOW, that whole
>
>   cd drivers
>   git diff A..B -- net/
>
> will actually show the diff for drivers/net - so the pathspec very
> much acts as relative to the cwd.

But that is not what I was talking about. Let's simplify. I'd say for any command that acts on "everything" when pathspec is not given, the two sets of actual paths affected by these two:

	git cmd -- "net/"
	git cmd -- ":!net/"

should have no overlap (obviously) and when you take union of the two sets, that should equal to

	git cmd --
i.e. no pathspecs.
Show 15 quoted lines
>>  2. I am not sure what ctype.c change is about.  Care to elaborate?
>
> I didn't see the need for it either until I made the rest of the
> patch, and it didn't work at all.
>
> The pathspec.c code uses "if (is_pathspec_magic(..))" to test whether
> a character is a short magiic pathspec character.  But '^' wasn't in
> that set, because it was already marked as being (only) in the regex
> set.
>
> Does that whole is_pathspec_magic() thing make any sense when we have
> an array that specifies the special characters we react to? No it does
> not.
>
> But it is what the code does, and I just made that code work.
Ah, OK.
Previous: Linus TorvaldsNext: Linus Torvalds
Message 6 of 17 in “Fwd: Possibly nicer pathspec syntax?”
  1. Linus TorvaldsFeb 7, 2017
  2. Junio C HamanoFeb 8, 2017
  3. Linus TorvaldsFeb 8, 2017
  4. Junio C HamanoFeb 8, 2017
  5. Linus TorvaldsFeb 8, 2017
  6. Junio C HamanoFeb 8, 2017
  7. Linus TorvaldsFeb 8, 2017
  8. Junio C HamanoFeb 8, 2017
  9. Linus TorvaldsFeb 8, 2017
  10. Duy NguyenFeb 8, 2017
  11. Junio C HamanoFeb 8, 2017
  12. Junio C HamanoFeb 8, 2017
  13. Duy NguyenFeb 9, 2017
  14. Duy NguyenFeb 9, 2017
  15. Mike HommeyFeb 8, 2017
  16. Linus TorvaldsFeb 8, 2017
  17. Mike HommeyFeb 8, 2017

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.