{"thread":{"id":"12232","subject":"[PATCH v2] Teach git-grep --name-only as synonym for -l","startedAt":"2008-02-21T04:28:07Z","lastAt":"2008-02-21T04:28:07Z","messageCount":1,"participants":["Shawn O. Pearce"],"isPatch":true,"patchVersion":2,"patchTotal":null},"messages":[{"id":"69450","messageId":"20080221042807.GA3235@spearce.org","threadId":"12232","inReplyTo":null,"subject":"[PATCH v2] Teach git-grep --name-only as synonym for -l","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2008-02-21T04:28:07Z","receivedAt":"2008-02-21T04:28:07Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"I expected git grep --name-only to give me only the file names,\nmuch as git diff --name-only only generates filenames.  Alas the\noption is -l, which matches common external greps but doesn't match\nother parts of the git UI.\n\nSigned-off-by: Shawn O. Pearce <spearce@spearce.org>\n---\n This time with documentation!\n\n Documentation/git-grep.txt |    4 +++-\n builtin-grep.c             |    1 +\n 2 files changed, 4 insertions(+), 1 deletions(-)\n\ndiff --git a/Documentation/git-grep.txt b/Documentation/git-grep.txt\nindex f3cb24f..71a7335 100644\n--- a/Documentation/git-grep.txt\n+++ b/Documentation/git-grep.txt\n@@ -75,9 +75,11 @@ OPTIONS\n -n::\n \tPrefix the line number to matching lines.\n \n--l | --files-with-matches | -L | --files-without-match::\n+-l | --files-with-matches | --name-only | -L | --files-without-match::\n \tInstead of showing every matched line, show only the\n \tnames of files that contain (or do not contain) matches.\n+\tFor better compatability with git-diff, --name-only is a\n+\tsynonym for --files-with-matches.\n \n -c | --count::\n \tInstead of showing every matched line, show the number of\ndiff --git a/builtin-grep.c b/builtin-grep.c\nindex 9180b39..f4f4ecb 100644\n--- a/builtin-grep.c\n+++ b/builtin-grep.c\n@@ -578,6 +578,7 @@ int cmd_grep(int argc, const char **argv, const char *prefix)\n \t\t\tcontinue;\n \t\t}\n \t\tif (!strcmp(\"-l\", arg) ||\n+\t\t    !strcmp(\"--name-only\", arg) ||\n \t\t    !strcmp(\"--files-with-matches\", arg)) {\n \t\t\topt.name_only = 1;\n \t\t\tcontinue;\n-- \n1.5.4.2.232.g08e5\n"}]}