[PATCH 0/6] make "^:foo" work without disambiguating "--"
- From
Jeff King <peff@peff.net>
- Date
- May 26, 2017, 19:06 UTC
- Message-ID
- <20170526190607.jr44oygs6mzm3q6e@sigill.intra.peff.net>
- In-Reply-To
- <20170526132432.zcoml5vphrzd557t@sigill.intra.peff.net>
On Fri, May 26, 2017 at 09:24:32AM -0400, Jeff King wrote:
Show 11 quoted lines
> The middle ground would be to replicate a simple subset of the rules in
> verify_filename(). If we assume that all arguments with ":(" are
> pathspecs (which seem rather unlikely to have false positives), then
> that leaves only a few short-magic patterns: :/, :!, and :^.
>
> We already specially handle :/ here. So it would really just be adding
> the other two (which are just aliases of each other). It's not that much
> code. The dirty thing is just that we're replicating some of the
> pathspec logic, and any new magic would have to be updated here, too.
>
> I'll see if I can work up a patch.So here's what I came up with. TBH, I could live without patch 5. What I care most about is making the ":^" work. But I don't really see a downside to it.
[1/6]: t4208: add check for ":/" without matching file [2/6]: check_filename(): refactor ":/" handling [3/6]: check_filename(): use skip_prefix [4/6]: check_filename(): handle ":^" path magic [5/6]: verify_filename(): treat ":(magic)" as a pathspec [6/6]: verify_filename(): flip order of checks
setup.c | 42 ++++++++++++++++++++++++++++++++---------- t/t4208-log-magic-pathspec.sh | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+), 10 deletions(-)
-Peff