GNU bug report logs - #42501
feature request: exclude-vcs option

Previous Next

Package: grep;

Reported by: Steve Ward <planet36 <at> gmail.com>

Date: Fri, 24 Jul 2020 01:33:02 UTC

Severity: wishlist

To reply to this bug, email your comments to 42501 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-grep <at> gnu.org:
bug#42501; Package grep. (Fri, 24 Jul 2020 01:33:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Steve Ward <planet36 <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-grep <at> gnu.org. (Fri, 24 Jul 2020 01:33:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Steve Ward <planet36 <at> gmail.com>
To: bug-grep <at> gnu.org
Subject: feature request: exclude-vcs option
Date: Thu, 23 Jul 2020 21:31:42 -0400
[Message part 1 (text/plain, inline)]
It would be nice to have an option to exclude version control system (VCS)
directories in a recursive grep.

This can be done effectively with these options
    --exclude-dir=.bzr --exclude-dir=CVS --exclude-dir=.git
--exclude-dir=.hg --exclude-dir=.svn

But having a single, simple option would be preferred.

tar already has this
    --exclude-vcs
        Exclude version control system directories.
[Message part 2 (text/html, inline)]

Information forwarded to bug-grep <at> gnu.org:
bug#42501; Package grep. (Sat, 06 Jul 2024 09:12:02 GMT) Full text and rfc822 format available.

Message #8 received at 42501 <at> debbugs.gnu.org (full text, mbox):

From: Collin Funk <collin.funk1 <at> gmail.com>
To: 42501 <at> debbugs.gnu.org
Subject: Re: feature request: exclude-vcs option
Date: Sat, 06 Jul 2024 02:10:11 -0700
[Message part 1 (text/plain, inline)]
I would like this feature too. I've attached a patch that I think should
work and then a very basic test case.

Also the following files should be added from GNU tar:

  /* Arch.  */
  ".arch-ids",
  "{arch}",
  "=RELEASE-ID",
  "=meta-update",
  "=update",
  /* Bazaar.  */
  ".bzr",
  ".bzrignore",
  ".bzrtags",

But I haven't used those version control systems so I am unsure which
ones are directories or not.

Thanks,
Collin

[0001-grep-add-new-exclude-vcs-option.patch (text/x-patch, attachment)]
[0002-tests-add-test-for-exclude-vcs.patch (text/x-patch, attachment)]

Information forwarded to bug-grep <at> gnu.org:
bug#42501; Package grep. (Sat, 06 Jul 2024 13:39:02 GMT) Full text and rfc822 format available.

Message #11 received at 42501 <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Collin Funk <collin.funk1 <at> gmail.com>, 42501 <at> debbugs.gnu.org
Subject: Re: bug#42501: feature request: exclude-vcs option
Date: Sat, 6 Jul 2024 15:38:40 +0200
On 7/6/24 11:10, Collin Funk wrote:
> But I haven't used those version control systems so I am unsure which
> ones are directories or not.

Yes, it's a bit of a puzzle. But for Git shouldn't we exclude only .git, 
and not .gitignore, .gitattributes, and .gitmodules? Normally these 
files are under Git control so "git grep" will search them, so shouldn't 
grep --exclude-vcs also search them? Similarly for .cvsignore, 
.hgignore, .hgtags.




Information forwarded to bug-grep <at> gnu.org:
bug#42501; Package grep. (Sat, 06 Jul 2024 20:22:01 GMT) Full text and rfc822 format available.

Message #14 received at 42501 <at> debbugs.gnu.org (full text, mbox):

From: Collin Funk <collin.funk1 <at> gmail.com>
To: Paul Eggert <eggert <at> cs.ucla.edu>
Cc: 42501 <at> debbugs.gnu.org
Subject: Re: bug#42501: feature request: exclude-vcs option
Date: Sat, 06 Jul 2024 13:20:28 -0700
Hi Paul,

Paul Eggert <eggert <at> cs.ucla.edu> writes:

> Yes, it's a bit of a puzzle. But for Git shouldn't we exclude only
> .git, and not .gitignore, .gitattributes, and .gitmodules? Normally
> these files are under Git control so "git grep" will search them, so
> shouldn't grep --exclude-vcs also search them? Similarly for
> .cvsignore, .hgignore, .hgtags.

I was basing it off the behavior of GNU tar. Doesn't --exclude-vcs there
ignore .gitignore, etc?

Note that the output of --help would make it seems otherwise. But when
tar'ing a local git clone I don't have a .gitignore in it.

$ tar --help | grep 'exclude-vcs'
      --exclude-vcs          exclude version control system directories
      --exclude-vcs-ignores  read exclude patterns from the VCS ignore files

Collin




Information forwarded to bug-grep <at> gnu.org:
bug#42501; Package grep. (Sat, 06 Jul 2024 21:02:02 GMT) Full text and rfc822 format available.

Message #17 received at 42501 <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Collin Funk <collin.funk1 <at> gmail.com>
Cc: 42501 <at> debbugs.gnu.org
Subject: Re: bug#42501: feature request: exclude-vcs option
Date: Sat, 6 Jul 2024 23:01:03 +0200
On 7/6/24 22:20, Collin Funk wrote:

> I was basing it off the behavior of GNU tar. Doesn't --exclude-vcs there
> ignore .gitignore, etc?

If so, maybe tar should change too.





Information forwarded to bug-grep <at> gnu.org:
bug#42501; Package grep. (Sat, 06 Jul 2024 21:16:01 GMT) Full text and rfc822 format available.

Message #20 received at 42501 <at> debbugs.gnu.org (full text, mbox):

From: Jeffrey Walton <noloader <at> gmail.com>
To: Steve Ward <planet36 <at> gmail.com>
Cc: 42501 <at> debbugs.gnu.org
Subject: Re: bug#42501: feature request: exclude-vcs option
Date: Sat, 6 Jul 2024 17:14:04 -0400
On Thu, Jul 23, 2020 at 9:33 PM Steve Ward <planet36 <at> gmail.com> wrote:
>
> It would be nice to have an option to exclude version control system (VCS)
> directories in a recursive grep.
>
> This can be done effectively with these options
>     --exclude-dir=.bzr --exclude-dir=CVS --exclude-dir=.git
> --exclude-dir=.hg --exclude-dir=.svn
>
> But having a single, simple option would be preferred.
>
> tar already has this
>     --exclude-vcs
>         Exclude version control system directories.

Add a mee too.

Jeff




This bug report was last modified 173 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.