Skip to content

Commit 0cce88f

Browse files
phil-blaingitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent a4514a4 commit 0cce88f

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

Documentation/diff-options.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -695,7 +695,10 @@ endif::git-format-patch[]
695695

696696
-W::
697697
--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]).
699702

700703
ifndef::git-format-patch[]
701704
ifndef::git-log[]

Documentation/git-grep.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ providing this option will cause it to die.
241241
--show-function::
242242
Show the preceding line that contains the function name of
243243
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
245245
patch hunk headers (see 'Defining a custom hunk-header' in
246246
linkgit:gitattributes[5]).
247247

@@ -266,7 +266,9 @@ providing this option will cause it to die.
266266
Show the surrounding text from the previous line containing a
267267
function name up to the one before the next function name,
268268
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]).
270272

271273
--threads <num>::
272274
Number of grep worker threads to use.

Documentation/line-range-format.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,6 @@ regular expression that denotes the range from the first funcname line
2727
that matches '<funcname>', up to the next funcname line. `:<funcname>`
2828
searches from the end of the previous `-L` range, if any, otherwise
2929
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]).

0 commit comments

Comments
 (0)