提交 9124cca6 编写于 作者: J Junio C Hamano

Merge branch 'mr/doc-negative-pathspec'

Doc updates.

* mr/doc-negative-pathspec:
  docs: improve discoverability of exclude pathspec
...@@ -61,6 +61,9 @@ OPTIONS ...@@ -61,6 +61,9 @@ OPTIONS
the working tree. Note that older versions of Git used the working tree. Note that older versions of Git used
to ignore removed files; use `--no-all` option if you want to ignore removed files; use `--no-all` option if you want
to add modified or new files but ignore removed ones. 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:: -n::
--dry-run:: --dry-run::
......
...@@ -289,6 +289,9 @@ providing this option will cause it to die. ...@@ -289,6 +289,9 @@ providing this option will cause it to die.
<pathspec>...:: <pathspec>...::
If given, limit the search to paths matching at least one pattern. If given, limit the search to paths matching at least one pattern.
Both leading paths match and glob(7) patterns are supported. 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 Examples
-------- --------
...@@ -305,6 +308,9 @@ Examples ...@@ -305,6 +308,9 @@ Examples
Looks for a line that has `NODE` or `Unexpected` in Looks for a line that has `NODE` or `Unexpected` in
files that have lines that match both. files that have lines that match both.
`git grep solution -- :^Documentation`::
Looks for `solution`, excluding files in `Documentation`.
GIT GIT
--- ---
Part of the linkgit:git[1] suite Part of the linkgit:git[1] suite
...@@ -111,6 +111,8 @@ configuration variable documented in linkgit:git-config[1]. ...@@ -111,6 +111,8 @@ configuration variable documented in linkgit:git-config[1].
without options are equivalent to 'always' and 'never' without options are equivalent to 'always' and 'never'
respectively. respectively.
<pathspec>...::
See the 'pathspec' entry in linkgit:gitglossary[7].
OUTPUT OUTPUT
------ ------
......
...@@ -407,7 +407,7 @@ these forms: ...@@ -407,7 +407,7 @@ these forms:
exclude;; exclude;;
After a path matches any non-exclude pathspec, it will be run 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 synonym `^`). If it matches, the path is ignored. When there
is no non-exclude pathspec, the exclusion is applied to the is no non-exclude pathspec, the exclusion is applied to the
result set as if invoked without any pathspec. result set as if invoked without any pathspec.
......
...@@ -25,7 +25,7 @@ EOF ...@@ -25,7 +25,7 @@ EOF
test_cmp expect actual 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" >expect &&
git log --oneline --format=%s -- ":(exclude)sub" >actual && git log --oneline --format=%s -- ":(exclude)sub" >actual &&
test_cmp expect actual test_cmp expect actual
...@@ -183,4 +183,15 @@ EOF ...@@ -183,4 +183,15 @@ EOF
test_cmp expect actual 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 test_done
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册