diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2017-02-07 21:05:28 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-02-10 13:19:10 -0800 |
commit | 42ebeb9d07de3c6d3a263f8ebce0508e489e5cc9 (patch) | |
tree | 234f4e3d7bfc1e7464da0447fd2ba95b41aef93f /pathspec.c | |
parent | 6e3a7b3398559305c7a239a42e447c21a8f39ff8 (diff) | |
download | git-42ebeb9d07de3c6d3a263f8ebce0508e489e5cc9.tar.gz |
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>
Diffstat (limited to 'pathspec.c')
-rw-r--r-- | pathspec.c | 6 |
1 files changed, 6 insertions, 0 deletions
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; |