From: Mikael Magnusson <mikachu@gmail.com>
To: Peter Stephenson <p.stephenson@samsung.com>
Cc: "Zsh Hackers' List" <zsh-workers@zsh.org>
Subject: Re: PATCH: short-circuiting glob exclusion operator
Date: Mon, 21 Mar 2016 21:39:07 +0100 [thread overview]
Message-ID: <CAHYJk3TV6GFKTG_t85Dwb3SFzi39uhOkxJAmNq4xt72iJ5gvyQ@mail.gmail.com> (raw)
In-Reply-To: <20160321183649.4fd4d72a@pwslap01u.europe.root.pri>
On Mon, Mar 21, 2016 at 7:36 PM, Peter Stephenson
<p.stephenson@samsung.com> wrote:
> This is a request for comments for now. I'm not yet entirely sure the
> pattern syntax with two tildes isn't going to cause problems (though I
> don't see what they would be), or that I've identified all the side
> effects that can happen.
>
> As an ultra brief summary, ~~ in a glob introduces a pattern that will
> prune directories on the way through in addition to acting in the normal
> exclusion fashion. So **/*~~*/foo stops at and ignores any directories
> called foo at any level(#1) on the way down. This is unlike a single
> tilde where exclusions are only performed after the complete set of
> matches is generated, so it's potentially much more efficient.
>
> (#1) Except the top. It's a bit anhoying you need (|*/).
Is it like (^foo/)##* then, except possibly easier to combine with
other patterns, and/or to stop on more complicated expressions? I
assume you could do **/*~~*/foo/(|*/)bar where * also can match across
multiple slashes to stop recursing in bar directories if we're already
in a foo directory. It's not immediately obvious to me how to achieve
that with (^foo/)##* so it's probably not possible ;).
Here's a possible problem with double tilde as the syntax:
% touch foo~ hi~ hello
% echo *~~hi*
foo~
If ~~ was special, this would mean * with hi* removed, and print hello
foo~ instead of just foo~, which could break existing users. Or more
dramatically like in this fictional example,
# remove all backup files except some I
# like to keep for plot purposes
rm *~~importantfile*
With the change this would wipe out both backups and originals.
--
Mikael Magnusson
next prev parent reply other threads:[~2016-03-21 20:39 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-21 18:36 Peter Stephenson
2016-03-21 20:39 ` Mikael Magnusson [this message]
2016-03-21 22:54 ` Bart Schaefer
2016-03-22 9:46 ` Peter Stephenson
2016-03-22 11:46 ` Jesper Nygårds
2016-03-23 9:56 ` Peter Stephenson
2016-03-26 15:40 ` Bart Schaefer
2016-04-07 20:10 ` Peter Stephenson
2016-04-08 3:18 ` Bart Schaefer
2016-04-09 18:22 ` Peter Stephenson
2016-04-09 19:00 ` Mikael Magnusson
2016-04-09 19:51 ` Peter Stephenson
2016-04-10 5:40 ` Bart Schaefer
2016-04-10 12:11 ` Peter Stephenson
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAHYJk3TV6GFKTG_t85Dwb3SFzi39uhOkxJAmNq4xt72iJ5gvyQ@mail.gmail.com \
--to=mikachu@gmail.com \
--cc=p.stephenson@samsung.com \
--cc=zsh-workers@zsh.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://git.vuxu.org/mirror/zsh/
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 NNTP newsgroup(s).