Skip to content

Commit

Permalink
Merge branch 'mr/doc-negative-pathspec'
Browse files Browse the repository at this point in the history
Doc updates.

* mr/doc-negative-pathspec:
  docs: improve discoverability of exclude pathspec
  • Loading branch information
gitster committed Oct 3, 2017
2 parents 9257d3d + 93dbefb commit 9124cca
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 2 deletions.
3 changes: 3 additions & 0 deletions Documentation/git-add.txt
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ OPTIONS
the working tree. Note that older versions of Git used
to ignore removed files; use `--no-all` option if you want
to add modified or new files but ignore removed ones.
+
For more details about the <pathspec> syntax, see the 'pathspec' entry
in linkgit:gitglossary[7].

-n::
--dry-run::
Expand Down
6 changes: 6 additions & 0 deletions Documentation/git-grep.txt
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,9 @@ providing this option will cause it to die.
<pathspec>...::
If given, limit the search to paths matching at least one pattern.
Both leading paths match and glob(7) patterns are supported.
+
For more details about the <pathspec> syntax, see the 'pathspec' entry
in linkgit:gitglossary[7].

Examples
--------
Expand All @@ -305,6 +308,9 @@ Examples
Looks for a line that has `NODE` or `Unexpected` in
files that have lines that match both.

`git grep solution -- :^Documentation`::
Looks for `solution`, excluding files in `Documentation`.

GIT
---
Part of the linkgit:git[1] suite
2 changes: 2 additions & 0 deletions Documentation/git-status.txt
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ configuration variable documented in linkgit:git-config[1].
without options are equivalent to 'always' and 'never'
respectively.

<pathspec>...::
See the 'pathspec' entry in linkgit:gitglossary[7].

OUTPUT
------
Expand Down
2 changes: 1 addition & 1 deletion Documentation/glossary-content.txt
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ these forms:

exclude;;
After a path matches any non-exclude pathspec, it will be run
through all exclude pathspec (magic signature: `!` or its
through all exclude pathspecs (magic signature: `!` or its
synonym `^`). If it matches, the path is ignored. When there
is no non-exclude pathspec, the exclusion is applied to the
result set as if invoked without any pathspec.
Expand Down
13 changes: 12 additions & 1 deletion t/t6132-pathspec-exclude.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ EOF
test_cmp expect actual
'

test_expect_success 'exclude only no longer errors out' '
test_expect_success 'exclude only pathspec uses default implicit pathspec' '
git log --oneline --format=%s -- . ":(exclude)sub" >expect &&
git log --oneline --format=%s -- ":(exclude)sub" >actual &&
test_cmp expect actual
Expand Down Expand Up @@ -183,4 +183,15 @@ EOF
test_cmp expect actual
'

test_expect_success 'multiple exclusions' '
git ls-files -- ":^*/file2" ":^sub2" >actual &&
cat <<-\EOF >expect &&
file
sub/file
sub/sub/file
sub/sub/sub/file
EOF
test_cmp expect actual
'

test_done

0 comments on commit 9124cca

Please sign in to comment.