Teach git-grep --name-only as synonym for -l
I expected git grep --name-only to give me only the file names, much as git diff --name-only only generates filenames. Alas the option is -l, which matches common external greps but doesn't match other parts of the git UI. Signed-off-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Shawn O. Pearce committed
Feb 20, 2008 at 23:28 UTC
2cd5dfd240ecb63c77bcb2532664984e3b69ae47
2 files changed
+4
-1
Documentation/git-grep.txt
+3
-1
@@ -75,9 +75,11 @@ OPTIONS
75
-n::
76
Prefix the line number to matching lines.
77
78
--l | --files-with-matches | -L | --files-without-match::
78
+-l | --files-with-matches | --name-only | -L | --files-without-match::
79
Instead of showing every matched line, show only the
80
names of files that contain (or do not contain) matches.
81
+ For better compatability with git-diff, --name-only is a
82
+ synonym for --files-with-matches.
83
84
-c | --count::
85
Instead of showing every matched line, show the number of
builtin-grep.c
+1
@@ -578,6 +578,7 @@ int cmd_grep(int argc, const char **argv, const char *prefix)
578
continue;
579
}
580
if (!strcmp("-l", arg) ||
581
+ !strcmp("--name-only", arg) ||
582
!strcmp("--files-with-matches", arg)) {
583
opt.name_only = 1;
584
continue;