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

Re: [WIP PATCH 0/5] support --exclude for diff/log commands

From
Nguyen Thai Ngoc Duy <pclouds@gmail.com>
Date
Mar 10, 2011, 10:05 UTC
Message-ID
<AANLkTimsv9bO+Go6Mqrrp_1-AZ=sC3ndyAuskPYLVbkv@mail.gmail.com>
In-Reply-To
<7vvczr5pw6.fsf@alter.siamese.dyndns.org>
2011/3/10 Junio C Hamano <gitster@pobox.com>:
Show 20 quoted lines
> Let's step back a bit.
>
> We chose to use ":/<regexp>" as one new form of extended SHA-1 expression
> to name an object for two reasons: (1) no normal <ref> can have a colon in
> it, because of check-ref-format restriction; (2) ":" is an unlikely letter
> to appear at the beginning of a pathname, and people with such a path can
> work around by saying "./:frotz" or "\:xyzzy".
>
> There is a disambiguation logic to check a list of arguments that lacks an
> explicit "--" separator to make sure that each element early on the list
> can only be interpreted as an object name but not as a pathname that
> exists on the filesystem, and all the remaining elements are pathnames
> that exist on the filesystem.
>
> If we introduce an extended syntax for pathspec and make the prefix magic
> character ":", and if we choose to use ":/" as one kind of magic, I was a
> bit worried that this may affect the disambiguation.  The users must use
> an explicit "--" when feeding a pathspec with the magic so that the parser
> knows which kind of magic (either object name magic or pathspec magic)
> they are talking about.

Or.. we can consider this ':' a special form of wildcard and interpret the same way:

 - first try exact match. If it matches, the leading ':' is
interpreted literally as part of file name.
 - magic.
Show 5 quoted lines
> I however realized that it is not an issue at all, because the users
> already need to disambiguate with "--" when using wildcards in their
> pathspecs (e.g. "git log 'Makefil*'" will give you an ambiguity error).
> Admittedly, wildcard pathspecs are lessor kind of magic, but they are
> magic nevertheless.
Yes, ':' is on the same side with wildcard pathspecs.
Show 5 quoted lines
> So my tentative conclusion is that there is no problem using the same ":"
> as the magic introducer for pathspecs, just like we do for object names.
>
>        Side note: please point out flaws in the above train of thought
>        that would make the end result non-workable.
Huh? I failed.
Show 6 quoted lines
> I am not very happy with ":!" as negative from syntactical point of view,
> because traditionally "!" is a tad cumbersome to quote in shells with
> history support (e.g. "csh"), but unfortunately I don't think of any good
> alternative that is easy to type.  Pathspecs are globs by nature, and "!"
> is a good choice of nagation indicator for that reason (think "[!aeiou]"
> not "[^aeiou]" the latter of which is a regexp and not glob), though.

We don't need to stick to ':!'. I just needed something to start coding. Other candidates can be '^' or '-' or '~'. '^' looks best in my opinion.

-- 
Duy
Previous: Junio C HamanoNext: Nguyen Thai Ngoc Duy
Message 12 of 20 in “support --exclude for diff/log commands”
  1. 0/5 support --exclude for diff/log commandsNguyễn Thái Ngọc Duy, Mar 10, 2011
  2. 1/5 tree-walk: support negative pathspecNguyễn Thái Ngọc Duy, Mar 10, 2011
  3. 2/5 match_pathspec_depth: support negative pathspecNguyễn Thái Ngọc Duy, Mar 10, 2011
  4. 3/5 revision.c: get rid of struct rev_info.prune_dataNguyễn Thái Ngọc Duy, Mar 10, 2011
  5. Junio C HamanoMar 10, 2011
  6. Nguyen Thai Ngoc DuyMar 10, 2011
  7. 4/5 diff: refactor init/release APINguyễn Thái Ngọc Duy, Mar 10, 2011
  8. 5/5 diff: support --excludeNguyễn Thái Ngọc Duy, Mar 10, 2011
  9. Junio C HamanoMar 10, 2011
  10. Nguyen Thai Ngoc DuyMar 10, 2011
  11. Junio C HamanoMar 10, 2011
  12. Nguyen Thai Ngoc DuyMar 10, 2011
  13. Nguyen Thai Ngoc DuyMar 21, 2011
  14. Michael J GruberMar 21, 2011
  15. Nguyen Thai Ngoc DuyMar 21, 2011
  16. Junio C HamanoMar 22, 2011
  17. Nguyen Thai Ngoc DuyMar 23, 2011
  18. Nguyen Thai Ngoc DuyMar 23, 2011
  19. Michael J GruberMar 23, 2011
  20. Nguyen Thai Ngoc DuyMar 23, 2011

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.