Skip to content

Commit

Permalink
grep: Add the option '--line-number'
Browse files Browse the repository at this point in the history
This is a synonym for the existing '-n' option, matching GNU grep.

Signed-off-by: Joe Ratterman <jratt0@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Joe Ratterman authored and Junio C Hamano committed Mar 28, 2011
1 parent 78bc466 commit 7d6cb10
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions Documentation/git-grep.txt
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ OPTIONS
as a regex).

-n::
--line-number::
Prefix the line number to matching lines.

-l::
Expand Down
2 changes: 1 addition & 1 deletion builtin/grep.c
Original file line number Diff line number Diff line change
Expand Up @@ -864,7 +864,7 @@ int cmd_grep(int argc, const char **argv, const char *prefix)
OPT_BOOLEAN('F', "fixed-strings", &opt.fixed,
"interpret patterns as fixed strings"),
OPT_GROUP(""),
OPT_BOOLEAN('n', NULL, &opt.linenum, "show line numbers"),
OPT_BOOLEAN('n', "line-number", &opt.linenum, "show line numbers"),
OPT_NEGBIT('h', NULL, &opt.pathname, "don't show filenames", 1),
OPT_BIT('H', NULL, &opt.pathname, "show filenames", 1),
OPT_NEGBIT(0, "full-name", &opt.relative,
Expand Down

0 comments on commit 7d6cb10

Please sign in to comment.