doc: add more pointers to gitattributes(5) for userdiff
Several Git commands can make use of the builtin userdiff patterns, but it's not obvious in the documentation. Add pointers to the 'Defining a custom hunk header' part of gitattributes(5) in the description of the following options: - the '--function-context' option of `git diff` and friends - the '--function-context' option of `git grep` - the '-L :<funcname>' option of `git log`, `gitk` and `git blame` In 'git-grep.txt', take the opportunity to use backticks in the description of '--show-function', and improve the wording of the desription of '--function-context'. Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Philippe Blain committed
Nov 1, 2020 at 17:28 UTC
0cce88f1e4b0ccbdc804db8b522aeb11b0f2b199
3 files changed
+11
-4
Documentation/diff-options.txt
+4
-1
@@ -695,7 +695,10 @@ endif::git-format-patch[]
695
696
-W::
697
--function-context::
698
- Show whole surrounding functions of changes.
698
+ Show whole function as context lines for each change.
699
+ The function names are determined in the same way as
700
+ `git diff` works out patch hunk headers (see 'Defining a
701
+ custom hunk-header' in linkgit:gitattributes[5]).
702
703
ifndef::git-format-patch[]
704
ifndef::git-log[]
Documentation/git-grep.txt
+4
-2
@@ -241,7 +241,7 @@ providing this option will cause it to die.
241
--show-function::
242
Show the preceding line that contains the function name of
243
the match, unless the matching line is a function name itself.
244
- The name is determined in the same way as 'git diff' works out
244
+ The name is determined in the same way as `git diff` works out
245
patch hunk headers (see 'Defining a custom hunk-header' in
246
linkgit:gitattributes[5]).
247
@@ -266,7 +266,9 @@ providing this option will cause it to die.
266
Show the surrounding text from the previous line containing a
267
function name up to the one before the next function name,
268
effectively showing the whole function in which the match was
269
- found.
269
+ found. The function names are determined in the same way as
270
+ `git diff` works out patch hunk headers (see 'Defining a
271
+ custom hunk-header' in linkgit:gitattributes[5]).
272
273
--threads <num>::
274
Number of grep worker threads to use.
Documentation/line-range-format.txt
+3
-1
@@ -27,4 +27,6 @@ regular expression that denotes the range from the first funcname line
27
that matches '<funcname>', up to the next funcname line. `:<funcname>`
28
searches from the end of the previous `-L` range, if any, otherwise
29
from the start of file. `^:<funcname>` searches from the start of
30
-file.
30
+file. The function names are determined in the same way as `git diff`
31
+works out patch hunk headers (see 'Defining a custom hunk-header'
32
+in linkgit:gitattributes[5]).