threads / patch / 12231

patchTeach git-grep --name-only as synonym for -l

Subject: [PATCH] Teach git-grep --name-only as synonym for -l

## tl;dr

One message between Feb 21, 2008 and Feb 21, 2008. Diffs are folded; open one to read it.

replies: 0people: 1as markdown or json

Shawn O. Pearce· Feb 21, 2008, 04:23 UTC · lore

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>
---
 builtin-grep.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
Show changes to builtin-grep.c +1 −0
diff --git a/builtin-grep.c b/builtin-grep.c
index 9180b39..f4f4ecb 100644
--- a/builtin-grep.c
+++ b/builtin-grep.c
@@ -578,6 +578,7 @@ int cmd_grep(int argc, const char **argv, const char *prefix)
 			continue;
 		}
 		if (!strcmp("-l", arg) ||
+		    !strcmp("--name-only", arg) ||
 		    !strcmp("--files-with-matches", arg)) {
 			opt.name_only = 1;
 			continue;
-- 
1.5.4.2.232.g08e5

← back to recent threads