From 42ebeb9d07de3c6d3a263f8ebce0508e489e5cc9 Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Tue, 7 Feb 2017 21:05:28 -0800 Subject: pathspec magic: add '^' as alias for '!' The choice of '!' for a negative pathspec ends up not only not matching what we do for revisions, it's also a horrible character for shell expansion since it needs quoting. So add '^' as an alternative alias for an excluding pathspec entry. Signed-off-by: Linus Torvalds Signed-off-by: Junio C Hamano --- pathspec.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'pathspec.c') diff --git a/pathspec.c b/pathspec.c index 7ababb3159..ecad034063 100644 --- a/pathspec.c +++ b/pathspec.c @@ -224,6 +224,12 @@ static const char *parse_short_magic(unsigned *magic, const char *elem) char ch = *pos; int i; + /* Special case alias for '!' */ + if (ch == '^') { + *magic |= PATHSPEC_EXCLUDE; + continue; + } + if (!is_pathspec_magic(ch)) break; -- cgit v1.3