[PATCH 0/3] handling pathspec magic with --follow
- From
Jeff King <peff@peff.net>
- Date
- Jun 1, 2023, 17:37 UTC
- Message-ID
- <20230601173724.GA4158369@coredump.intra.peff.net>
- In-Reply-To
- <51012e79-c6ce-41dd-9755-960e065214ef@app.fastmail.com>
On Sat, May 27, 2023 at 09:00:27PM +0200, Jim Pryor wrote:
> Confirmed I have log.follow = true, and also GIT_NOGLOB_PATHSPECS set, > thus the explicit `(glob)` magic.
OK, all of that makes sense. The same problem hits ":(icase)" and other pathspec magic, too. So talking about :(glob) too much is kind of a red herring, anyway.
> I'd be happy with --follow not working with the wildcard pathspecs, > but with the crash avoided.
Here's a series that I think should improve things for you. For an explicit --follow, it finds the forbidden magic sooner (which gives us a nice error message instead of the BUG()), and for log.follow, it avoids follow-mode when forbidden pathspecs are used rather than enabling it and then complaining.
The interesting bits are in the third patch. The other two are preparatory.
[1/3]: pathspec: factor out magic-to-name function [2/3]: diff: factor out --follow pathspec check [3/3]: diff: detect pathspec magic not supported by --follow
builtin/log.c | 2 +- diff.c | 29 +++++++++++++++++++++++++++-- diff.h | 7 +++++++ pathspec.c | 19 ++++++++++++------- pathspec.h | 8 ++++++++ t/t4202-log.sh | 15 +++++++++++++++ 6 files changed, 70 insertions(+), 10 deletions(-)