Re: git file listing is inconsistent

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Woody,

Woody Gilk wrote:

> git diff --name-only
> git grep --files-with-matches
>
> I think --files-with-matches should be deprecated and replaced with
> --name-only for consistency.

See the (non-git) diff(1) and grep(1) manpages.

It might make sense for 'git grep' to learn --name-only too as a
synonym to help muscle memory, though.

*looks*

Actually, 'git grep -h' tells me that git grep --name-only is already
accepted as a synonym for --files-with-matches, ever since

 $ git log -Sname-only -- builtin-grep.c
[...]
 commit 2cd5dfd240ecb63c77bcb2532664984e3b69ae47
 Author: Shawn O. Pearce <spearce@xxxxxxxxxxx>
 Date:   Wed Feb 20 23:28:07 2008 -0500

     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@xxxxxxxxxxx>
     Signed-off-by: Junio C Hamano <gitster@xxxxxxxxx>

(v1.5.5-rc0~171).  Have you tried it?

Would something like the following patch help?

-- >8 --
Subject: grep doc: add reminder about --name-only option

Since v1.5.5-rc0~171 (2008-02-20), "git grep" accepts --name-only
as a synonym for the GNU-style --files-with-matches, but because the
synonym is not mentioned in the manpage synopsis it is hard to find.

Reported-by: Woody Gilk <woody.gilk@xxxxxxxxx>
Signed-off-by: Jonathan Nieder <jrnieder@xxxxxxxxx>
---
 Documentation/git-grep.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Documentation/git-grep.txt b/Documentation/git-grep.txt
index 31811f1..8060efe 100644
--- a/Documentation/git-grep.txt
+++ b/Documentation/git-grep.txt
@@ -14,7 +14,7 @@ SYNOPSIS
 	   [-E | --extended-regexp] [-G | --basic-regexp]
 	   [-P | --perl-regexp]
 	   [-F | --fixed-strings] [-n | --line-number]
-	   [-l | --files-with-matches] [-L | --files-without-match]
+	   [-l | --files-with-matches | --name-only] [-L | --files-without-match]
 	   [(-O | --open-files-in-pager) [<pager>]]
 	   [-z | --null]
 	   [-c | --count] [--all-match] [-q | --quiet]
-- 
2.2.0.rc0.207.ga3a616c

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]