From: Mike Hommey <mh@glandium.org>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Git Mailing List <git@vger.kernel.org>,
Junio C Hamano <gitster@pobox.com>
Subject: Re: Fwd: Possibly nicer pathspec syntax?
Date: Wed, 8 Feb 2017 11:40:42 +0900 [thread overview]
Message-ID: <20170208024042.trmkjm4jnxidcflg@glandium.org> (raw)
In-Reply-To: <alpine.LFD.2.20.1702071739060.17609@i7.lan>
On Tue, Feb 07, 2017 at 05:48:26PM -0800, Linus Torvalds wrote:
>
>
> On Tue, 7 Feb 2017, Linus Torvalds wrote:
> >
> > [ Clarification from original message, since Junio asked: I didn't
> > actually want the semantics of '.' at all, since in a subdirectory it
> > limits to the current subdirectory. So I'd suggest that in the absence
> > of any positive pattern, there is simply no filtering at all, so
> > whenever I say '.' as a pattern, I really meant ":(top)." which is
> > even more of a cumbersom syntax that the current model really
> > encourages. Crazy. Since I tend to always work in the top directory,
> > the two are the same for me ]
>
> So here's an RFC patch, and I'm quoting the above part of my thinking
> because it's what the patch does, but it turns out that it's probably not
> what we want, and I suspect the "." behavior (as opposed to "no filtering
> at all") is actually better.
>
> Now _I_ don't much care, since I only work from the top level, but without
> the "." behavior, you get into an odd situation that the negative match
> will be relative to the current directory, but then the positive matches
> will be everywhere else.
>
> Obviously, a negative match that has "top" set would change that logic. So
> this patch is purely a request for further discussion.
>
> When I wrote the patch, I actually also removed the now stale entries from
> the 'po' files, but I'm not including that part here because it just
> distracts from the meat of it all. So this diff was actually generated
> with the new syntax:
>
> git diff -p --stat -- :^po/
>
> and the only thing even remotely subtle here is that it changes our ctype
> array to make '^' be both a regex and a pathspec magic character.
>
> Everything else should be pretty darn obvious.
>
> The code *could* just track all the 'relative to top or not' bits in the
> exclusion pattern, and then use whatever top-ness the exclusion patterns
> have (and maybe fall back to the old warning if it had a mixture of
> exclusionary patterns). I'll happily change it to act that way if people
> think that makes sense.
>
> Comments?
It seems to me that `git diff` and `git diff -- :^stuff` should have the
same output if there aren't changes in stuff, and `git diff` does the
same as `git diff -- :/` if you are in a subdirectory, not the same as
`git diff .`.
As such, the default positive match should be ':/' (which is shorter and
less cumbersome than ':(top)', btw)
Mike
next prev parent reply other threads:[~2017-02-08 3:11 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CA+55aFyznf1k=iyiQx6KLj3okpid0-HexZWsVkxt7LqCdz+O5A@mail.gmail.com>
2017-02-07 23:12 ` Fwd: Possibly nicer pathspec syntax? Linus Torvalds
2017-02-08 0:54 ` Junio C Hamano
2017-02-08 1:48 ` Linus Torvalds
2017-02-08 2:40 ` Mike Hommey [this message]
2017-02-08 2:49 ` Linus Torvalds
2017-02-08 3:06 ` Mike Hommey
2017-02-08 2:42 ` Junio C Hamano
2017-02-08 3:02 ` Linus Torvalds
2017-02-08 3:12 ` Junio C Hamano
2017-02-08 3:28 ` Linus Torvalds
2017-02-08 4:42 ` Junio C Hamano
2017-02-08 5:12 ` Linus Torvalds
2017-02-08 6:39 ` Duy Nguyen
2017-02-08 17:39 ` Junio C Hamano
2017-02-08 21:11 ` Junio C Hamano
2017-02-09 13:48 ` Duy Nguyen
2017-02-09 13:27 ` Duy Nguyen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170208024042.trmkjm4jnxidcflg@glandium.org \
--to=mh@glandium.org \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).