git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* git file listing is inconsistent
@ 2014-11-26 21:10 Woody Gilk
  2014-11-26 21:47 ` Junio C Hamano
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Woody Gilk @ 2014-11-26 21:10 UTC (permalink / raw)
  To: git

git diff --name-only
git grep --files-with-matches

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

Thanks,
--
Woody Gilk
http://about.me/shadowhand

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: git file listing is inconsistent
  2014-11-26 21:10 git file listing is inconsistent Woody Gilk
@ 2014-11-26 21:47 ` Junio C Hamano
  2014-11-26 21:55 ` Jonathan Nieder
  2014-11-26 21:59 ` Scott Schmit
  2 siblings, 0 replies; 5+ messages in thread
From: Junio C Hamano @ 2014-11-26 21:47 UTC (permalink / raw)
  To: Woody Gilk; +Cc: git

Woody Gilk <woody.gilk@gmail.com> writes:

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

That longer name comes from "GNU grep" consistency.

Why anybody does not use a shorter and sweeter "grep -l" is beyond
me, though ;-)

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: git file listing is inconsistent
  2014-11-26 21:10 git file listing is inconsistent Woody Gilk
  2014-11-26 21:47 ` Junio C Hamano
@ 2014-11-26 21:55 ` Jonathan Nieder
  2014-11-26 22:01   ` Woody Gilk
  2014-11-26 21:59 ` Scott Schmit
  2 siblings, 1 reply; 5+ messages in thread
From: Jonathan Nieder @ 2014-11-26 21:55 UTC (permalink / raw)
  To: Woody Gilk; +Cc: git

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@spearce.org>
 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@spearce.org>
     Signed-off-by: Junio C Hamano <gitster@pobox.com>

(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@gmail.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
 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

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: git file listing is inconsistent
  2014-11-26 21:10 git file listing is inconsistent Woody Gilk
  2014-11-26 21:47 ` Junio C Hamano
  2014-11-26 21:55 ` Jonathan Nieder
@ 2014-11-26 21:59 ` Scott Schmit
  2 siblings, 0 replies; 5+ messages in thread
From: Scott Schmit @ 2014-11-26 21:59 UTC (permalink / raw)
  To: Woody Gilk; +Cc: git

[-- Attachment #1: Type: text/plain, Size: 584 bytes --]

On Wed, Nov 26, 2014 at 03:10:33PM -0600, 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.

git grep supports both: --name-only for consistency with other git
commands, and --files-with-matches for consistency with grep(1).

So I don't think anything needs to change.  All we need to do is to
teach grep(1) the --name-only option, and the cycle will be complete.
[I can never remember grep's version of the option...] :-D

-- 
Scott Schmit

[-- Attachment #2: smime.p7s --]
[-- Type: application/x-pkcs7-signature, Size: 3891 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: git file listing is inconsistent
  2014-11-26 21:55 ` Jonathan Nieder
@ 2014-11-26 22:01   ` Woody Gilk
  0 siblings, 0 replies; 5+ messages in thread
From: Woody Gilk @ 2014-11-26 22:01 UTC (permalink / raw)
  To: Jonathan Nieder; +Cc: git

Jonathan,

On Wed, Nov 26, 2014 at 3:55 PM, Jonathan Nieder <jrnieder@gmail.com> wrote:
> Actually, 'git grep -h' tells me that git grep --name-only is already
> accepted as a synonym for --files-with-matches, ever since

You are absolutely right, it was a typo (and then not RTFM the
resulting help) on my part that caused the confusion.

Nothing needs to change here. :)
--
Woody Gilk
http://about.me/shadowhand

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-11-26 22:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-26 21:10 git file listing is inconsistent Woody Gilk
2014-11-26 21:47 ` Junio C Hamano
2014-11-26 21:55 ` Jonathan Nieder
2014-11-26 22:01   ` Woody Gilk
2014-11-26 21:59 ` Scott Schmit

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).