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 <torvalds@linux-foundation.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Linus Torvalds committed
Feb 7, 2017 at 21:05 UTC
42ebeb9d07de3c6d3a263f8ebce0508e489e5cc9
2 files changed
+8
-2
Documentation/glossary-content.txt
+2
-2
@@ -386,8 +386,8 @@ Glob magic is incompatible with literal magic.
386
387
exclude;;
388
After a path matches any non-exclude pathspec, it will be run
389
- through all exclude pathspec (magic signature: `!`). If it
390
- matches, the path is ignored.
389
+ through all exclude pathspec (magic signature: `!` or its
390
+ synonym `^`). If it matches, the path is ignored.
391
--
392
393
[[def_parent]]parent::
pathspec.c
+6
@@ -224,6 +224,12 @@ static const char *parse_short_magic(unsigned *magic, const char *elem)
224
char ch = *pos;
225
int i;
226
227
+ /* Special case alias for '!' */
228
+ if (ch == '^') {
229
+ *magic |= PATHSPEC_EXCLUDE;
230
+ continue;
231
+ }
232
+
233
if (!is_pathspec_magic(ch))
234
break;
235