Skip to content

Commit 8a19eee

Browse files
committed
Merge branch 'mr/doc-negative-pathspec' into maint
Doc updates. * mr/doc-negative-pathspec: docs: improve discoverability of exclude pathspec
2 parents 41052b1 + 93dbefb commit 8a19eee

File tree

5 files changed

+24
-2
lines changed

5 files changed

+24
-2
lines changed

Documentation/git-add.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ OPTIONS
6161
the working tree. Note that older versions of Git used
6262
to ignore removed files; use `--no-all` option if you want
6363
to add modified or new files but ignore removed ones.
64+
+
65+
For more details about the <pathspec> syntax, see the 'pathspec' entry
66+
in linkgit:gitglossary[7].
6467

6568
-n::
6669
--dry-run::

Documentation/git-grep.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,9 @@ providing this option will cause it to die.
296296
<pathspec>...::
297297
If given, limit the search to paths matching at least one pattern.
298298
Both leading paths match and glob(7) patterns are supported.
299+
+
300+
For more details about the <pathspec> syntax, see the 'pathspec' entry
301+
in linkgit:gitglossary[7].
299302

300303
Examples
301304
--------
@@ -312,6 +315,9 @@ Examples
312315
Looks for a line that has `NODE` or `Unexpected` in
313316
files that have lines that match both.
314317

318+
`git grep solution -- :^Documentation`::
319+
Looks for `solution`, excluding files in `Documentation`.
320+
315321
GIT
316322
---
317323
Part of the linkgit:git[1] suite

Documentation/git-status.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,8 @@ configuration variable documented in linkgit:git-config[1].
111111
without options are equivalent to 'always' and 'never'
112112
respectively.
113113

114+
<pathspec>...::
115+
See the 'pathspec' entry in linkgit:gitglossary[7].
114116

115117
OUTPUT
116118
------

Documentation/glossary-content.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ these forms:
407407

408408
exclude;;
409409
After a path matches any non-exclude pathspec, it will be run
410-
through all exclude pathspec (magic signature: `!` or its
410+
through all exclude pathspecs (magic signature: `!` or its
411411
synonym `^`). If it matches, the path is ignored. When there
412412
is no non-exclude pathspec, the exclusion is applied to the
413413
result set as if invoked without any pathspec.

t/t6132-pathspec-exclude.sh

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ EOF
2525
test_cmp expect actual
2626
'
2727

28-
test_expect_success 'exclude only no longer errors out' '
28+
test_expect_success 'exclude only pathspec uses default implicit pathspec' '
2929
git log --oneline --format=%s -- . ":(exclude)sub" >expect &&
3030
git log --oneline --format=%s -- ":(exclude)sub" >actual &&
3131
test_cmp expect actual
@@ -183,4 +183,15 @@ EOF
183183
test_cmp expect actual
184184
'
185185

186+
test_expect_success 'multiple exclusions' '
187+
git ls-files -- ":^*/file2" ":^sub2" >actual &&
188+
cat <<-\EOF >expect &&
189+
file
190+
sub/file
191+
sub/sub/file
192+
sub/sub/sub/file
193+
EOF
194+
test_cmp expect actual
195+
'
196+
186197
test_done

0 commit comments

Comments
 (0)