Merge branch 'rs/grep-function-context'
authorJunio C Hamano <gitster@pobox.com>
Thu, 11 Aug 2011 18:03:09 +0000 (11:03 -0700)
committerJunio C Hamano <gitster@pobox.com>
Thu, 11 Aug 2011 18:03:09 +0000 (11:03 -0700)
* rs/grep-function-context:
grep: long context options
grep: add option to show whole function as context

1  2 
Documentation/git-grep.txt
index 062711139c0da753125ae429d7cc3c8a1368a279,af501d2424249e0dd0e6c706a84b8de55b7738b9..e44a4988b7a7ed7100da6e2ba098d7fda17a2f83
@@@ -155,15 -155,6 +155,6 @@@ OPTION
        Show the filename above the matches in that file instead of
        at the start of each shown line.
  
- -[ABC] <context>::
-       Show `context` trailing (`A` -- after), or leading (`B`
-       -- before), or both (`C` -- context) lines, and place a
-       line containing `--` between contiguous groups of
-       matches.
- -<num>::
-       A shortcut for specifying `-C<num>`.
  -p::
  --show-function::
        Show the preceding line that contains the function name of
        patch hunk headers (see 'Defining a custom hunk-header' in
        linkgit:gitattributes[5]).
  
+ -<num>::
+ -C <num>::
+ --context <num>::
+       Show <num> leading and trailing lines, and place a line
+       containing `--` between contiguous groups of matches.
+ -A <num>::
+ --after-context <num>::
+       Show <num> trailing lines, and place a line containing
+       `--` between contiguous groups of matches.
+ -B <num>::
+ --before-context <num>::
+       Show <num> leading lines, and place a line containing
+       `--` between contiguous groups of matches.
+ -W::
+ --function-context::
+       Show the surrounding text from the previous line containing a
+       function name up to the one before the next function name,
+       effectively showing the whole function in which the match was
+       found.
  -f <file>::
        Read patterns from <file>, one per line.
  
  Examples
  --------
  
 -git grep {apostrophe}time_t{apostrophe} \-- {apostrophe}*.[ch]{apostrophe}::
 +`git grep {apostrophe}time_t{apostrophe} \-- {apostrophe}*.[ch]{apostrophe}`::
        Looks for `time_t` in all tracked .c and .h files in the working
        directory and its subdirectories.
  
 -git grep -e {apostrophe}#define{apostrophe} --and \( -e MAX_PATH -e PATH_MAX \)::
 +`git grep -e {apostrophe}#define{apostrophe} --and \( -e MAX_PATH -e PATH_MAX \)`::
        Looks for a line that has `#define` and either `MAX_PATH` or
        `PATH_MAX`.
  
 -git grep --all-match -e NODE -e Unexpected::
 +`git grep --all-match -e NODE -e Unexpected`::
        Looks for a line that has `NODE` or `Unexpected` in
        files that have lines that match both.