From unknown Fri Jun 20 07:25:10 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#42501 <42501@debbugs.gnu.org> To: bug#42501 <42501@debbugs.gnu.org> Subject: Status: feature request: exclude-vcs option Reply-To: bug#42501 <42501@debbugs.gnu.org> Date: Fri, 20 Jun 2025 14:25:10 +0000 retitle 42501 feature request: exclude-vcs option reassign 42501 grep submitter 42501 Steve Ward severity 42501 wishlist thanks From debbugs-submit-bounces@debbugs.gnu.org Thu Jul 23 21:32:08 2020 Received: (at submit) by debbugs.gnu.org; 24 Jul 2020 01:32:08 +0000 Received: from localhost ([127.0.0.1]:46363 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jymZD-0006Yz-WC for submit@debbugs.gnu.org; Thu, 23 Jul 2020 21:32:08 -0400 Received: from lists.gnu.org ([209.51.188.17]:38022) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jymZA-0006Yp-FT for submit@debbugs.gnu.org; Thu, 23 Jul 2020 21:32:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40606) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jymZA-0000Sz-8a for bug-grep@gnu.org; Thu, 23 Jul 2020 21:32:04 -0400 Received: from mail-io1-xd2c.google.com ([2607:f8b0:4864:20::d2c]:41280) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jymZ8-0007vh-GR for bug-grep@gnu.org; Thu, 23 Jul 2020 21:32:03 -0400 Received: by mail-io1-xd2c.google.com with SMTP id p205so8289793iod.8 for ; Thu, 23 Jul 2020 18:32:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=hWRtU+NxJfMu3cyJFeIg9zsvyzm1KNqQPvP7XT0sNNo=; b=SukHqJBn/gVlN7DHxV+7Zq9IxDNjLrjvxA2X5P1diYEcod7NVSdtg1s+drPlKAMdtD AwXlSyiLSpwuWl7oo6HiARACj/Y0O5i3xAmnbT+9kExtoQnDNqMpJaZq86wmHdGJMKJj L029VqCkHj+D5C8fUFKUkMBRzgWqm02R7Ow0AAcvd8qjyvv2shKQvcQf/5DKYd0nJKem jW3mVBj95IDrOEIfCK+xfjy3UaS1+6l4hsYQ0TXdyUk2Md3Um+w+57gm47GJiTn4nSqb ZQDXJ5gRzrOfe5NKZkvRFujP5/DP8srU+uiFCms72wD/ZiqKVm8RBmlafaXldCUymU1P v9/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=hWRtU+NxJfMu3cyJFeIg9zsvyzm1KNqQPvP7XT0sNNo=; b=CS9btPw5932/hIvL7gaf7fgb/ojbpOQhey9wqshfmEbPiopd3R9fpVFEgeGcLkrN8C Lk+/5VMACGG+bRWTCR/MfbeZmkZLb9u1vGMm9XB2QGkYUH6uy9Z7ju1cMshW/1eHSoAw gYd+G98SBBNqphJrD4RJAHwGduzgdLkQcIvuFkBGz6N7QMc+kLdrizfmtL/at17dFOjI s1UXZv5qHK4iWUgrHNUQ1Mbiv4QKqnmU5MlfAI4E9QD+9uib1mL+5xk4oqcktrKDEk98 v69OyxTum5KkE+1qyTQITG3xjz8d7Vw+QzYvHhLiGwQJ1xx7iO/AIqOqYNsnqPeNdD7m a/Pg== X-Gm-Message-State: AOAM532vLitLwdJlsDXywMbSvsL/tawmbrvcRut+JRVfHk8D7zQTOs4a Ri46h3HanWlOxTS0NGNakN7liYDTaJnd8PhpYm12EQdp X-Google-Smtp-Source: ABdhPJx0KrNMkqHHxH8UpEST+SrqBBiaBvQOhrHrarFK+X2Is24P/j+QYBDMDKFbxhTFCjHB07jR2bLVHjy7b6U+7YA= X-Received: by 2002:a05:6602:220f:: with SMTP id n15mr7954703ion.103.1595554320363; Thu, 23 Jul 2020 18:32:00 -0700 (PDT) MIME-Version: 1.0 From: Steve Ward Date: Thu, 23 Jul 2020 21:31:42 -0400 Message-ID: Subject: feature request: exclude-vcs option To: bug-grep@gnu.org Content-Type: multipart/alternative; boundary="0000000000007c330805ab25f0d5" Received-SPF: pass client-ip=2607:f8b0:4864:20::d2c; envelope-from=planet36@gmail.com; helo=mail-io1-xd2c.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: 1 X-Spam_score: 0.1 X-Spam_bar: / X-Spam_report: (0.1 / 5.0 requ) BAYES_20=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -0.1 (/) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.1 (--) --0000000000007c330805ab25f0d5 Content-Type: text/plain; charset="UTF-8" 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. --0000000000007c330805ab25f0d5 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
It would be nice to have an option to exclude version cont= rol system (VCS) directories in a recursive grep.

This can be done effectively with these options
=C2=A0 =C2=A0 --exclude-dir=3D.bzr --exclude-dir=3DC= VS --exclude-dir=3D.git --exclude-dir=3D.hg --exclude-dir=3D.svn

But= having a single, simple option would be preferred.

tar already has = this
=C2=A0 =C2=A0 --exclude-vcs
=C2=A0 =C2=A0 =C2=A0 =C2=A0 Exclude = version control system directories.

--0000000000007c330805ab25f0d5-- From debbugs-submit-bounces@debbugs.gnu.org Sat Jul 06 05:11:27 2024 Received: (at 42501) by debbugs.gnu.org; 6 Jul 2024 09:11:27 +0000 Received: from localhost ([127.0.0.1]:45591 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sQ1S2-0007xk-Ix for submit@debbugs.gnu.org; Sat, 06 Jul 2024 05:11:27 -0400 Received: from mail-pj1-f47.google.com ([209.85.216.47]:55715) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sQ1Rz-0007xY-U5 for 42501@debbugs.gnu.org; Sat, 06 Jul 2024 05:11:24 -0400 Received: by mail-pj1-f47.google.com with SMTP id 98e67ed59e1d1-2c9df3eb0edso166005a91.3 for <42501@debbugs.gnu.org>; Sat, 06 Jul 2024 02:11:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1720257014; x=1720861814; darn=debbugs.gnu.org; h=mime-version:user-agent:message-id:date:subject:to:from:from:to:cc :subject:date:message-id:reply-to; bh=rtc3s3ziSOLtXizNezhgZl0cqdTATOwc9hbunmHz/zg=; b=K+HrrHq1/75npqmiTAfbYT0haszM+qwXKb/Nt0VaUUl52ttiO7m03CU/07Jokse/uw ocGe98okIvHI5ZS/lx1Hg0vJg2ffKgEnQ/yhEksY472EIS7uyd88kLDHTh5frRTTLWs5 /um6kydp5lhDcxx8SvkG0hk7VJRyNOiLCln1/951bWsUtyZA32PQfVnLfoDp5VdEuFgH 1gvi9fm+lvlCzyzd1vBgu8bjHcQ1WMF3M39SlbP1U4g0YJkNra346hmqhf+fBt5gTqQD eG/MyxZZj9VrA3s7qAVj2lvLxM1c7Sids1vaT4yuIKhN+/rawiK4DeJFVDKKtvI0UsWa a56g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720257014; x=1720861814; h=mime-version:user-agent:message-id:date:subject:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=rtc3s3ziSOLtXizNezhgZl0cqdTATOwc9hbunmHz/zg=; b=kQ6s0HTj0IMie6qU4HUxv/SRBw1Tp3Ejeh5cm68t9JhK69INh3mT2Oy3wusaHKouqm YFit6Q+kbjAPCVdcU5KBNVj412hxClFVUPpwq5g5OKtirh30VFjcFgk3KX5mNN7Z60oQ fH1qhQMVUdmykW5R0hXbbg+HgULSmL7EktXdxeAL1aCvx6+yVfriEw3v7qb85QO+FRWV KvVHnYXD0TjO8nXWyaNniYCCYbnrcNfVuTNNLMAXH/WtjhDMvF2r3uHpANZZyZf4w3Ma TORROCP7joYJU6SWccs2tunJ1w+kwogXTLbOVwJovtYbdCun21ZZ/PsbJBNs5lM0W+sD quJQ== X-Gm-Message-State: AOJu0Yz4VSA5F73Ke2ToOPdo+H1riFjXuAH9wlZKwUPoBWt8y7lX33So 0zxn5f3mwmKBFd9UPfLKjPw2MML6X2hVmDYWEbRJRZ3gtHiMjnB2IKwVGg== X-Google-Smtp-Source: AGHT+IENBeE+QnPvHcp4xws6BneZgf4c/Nq0rsIZtrmHZdR3oGL+dhzpFEiXGaIPCWCr/C+HzQEAGQ== X-Received: by 2002:a17:90a:bb92:b0:2c9:9ad5:7cac with SMTP id 98e67ed59e1d1-2c99c50ff8bmr5151402a91.1.1720257013601; Sat, 06 Jul 2024 02:10:13 -0700 (PDT) Received: from fedora ([2601:646:8002:f840::58c7]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2c99a97282csm4683318a91.20.2024.07.06.02.10.11 for <42501@debbugs.gnu.org> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Jul 2024 02:10:12 -0700 (PDT) From: Collin Funk To: 42501@debbugs.gnu.org Subject: Re: feature request: exclude-vcs option Date: Sat, 06 Jul 2024 02:10:11 -0700 Message-ID: <875xtiga30.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: 0.3 (/) X-Debbugs-Envelope-To: 42501 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) --=-=-= Content-Type: text/plain 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 --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-grep-add-new-exclude-vcs-option.patch >From 9462055c1692934c02d39c9962268094b3e03113 Mon Sep 17 00:00:00 2001 From: Collin Funk Date: Sat, 6 Jul 2024 01:36:49 -0700 Subject: [PATCH 1/2] grep: add new --exclude-vcs option * src/grep.c (struct vcs_file): New structure. (vcs_file_table): New variable. (EXCLUDE_VCS_OPTION, long_options, main): Add the --exclude-vcs option. * src/system.h (ARRAY_CARDINALITY): New definition. --- src/grep.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ src/system.h | 4 ++++ 2 files changed, 56 insertions(+) diff --git a/src/grep.c b/src/grep.c index 669238b..4c24e55 100644 --- a/src/grep.c +++ b/src/grep.c @@ -479,6 +479,36 @@ fflush_errno (void) stdout_errno = errno; } +struct vcs_file +{ + const char *name; + bool directory; +}; + +static struct vcs_file const vcs_file_table[] = +{ + /* CVS. */ + {"CVS", true}, + {".cvsignore", false}, + /* RCS. */ + {"RCS", true}, + /* SCCS. */ + {"SCCS", true}, + /* Subversion. */ + {".svn", true}, + /* Git. */ + {".git", true}, + {".gitignore", false}, + {".gitattributes", false}, + {".gitmodules", false}, + /* Mercurial. */ + {".hg", true}, + {".hgignore", false}, + {".hgtags", false}, + /* Darcs. */ + {"_darcs", true}, +}; + static struct exclude *excluded_patterns[2]; static struct exclude *excluded_directory_patterns[2]; /* Short options. */ @@ -493,6 +523,7 @@ enum EXCLUDE_DIRECTORY_OPTION, EXCLUDE_OPTION, EXCLUDE_FROM_OPTION, + EXCLUDE_VCS_OPTION, GROUP_SEPARATOR_OPTION, INCLUDE_OPTION, LINE_BUFFERED_OPTION, @@ -521,6 +552,7 @@ static struct option const long_options[] = {"exclude", required_argument, nullptr, EXCLUDE_OPTION}, {"exclude-from", required_argument, nullptr, EXCLUDE_FROM_OPTION}, {"exclude-dir", required_argument, nullptr, EXCLUDE_DIRECTORY_OPTION}, + {"exclude-vcs", no_argument, nullptr, EXCLUDE_VCS_OPTION}, {"file", required_argument, nullptr, 'f'}, {"files-with-matches", no_argument, nullptr, 'l'}, {"files-without-match", no_argument, nullptr, 'L'}, @@ -2806,6 +2838,26 @@ main (int argc, char **argv) } break; + case EXCLUDE_VCS_OPTION: + for (int cmd = 0; cmd < 2; ++cmd) + { + if (!excluded_patterns[cmd]) + excluded_patterns[cmd] = new_exclude (); + if (!excluded_directory_patterns[cmd]) + excluded_directory_patterns[cmd] = new_exclude (); + for (idx_t i = 0; i < ARRAY_CARDINALITY (vcs_file_table); ++i) + { + struct vcs_file file = vcs_file_table[i]; + if (file.directory) + add_exclude (excluded_directory_patterns[cmd], file.name, + exclude_options (cmd)); + else + add_exclude (excluded_patterns[cmd], file.name, + exclude_options (cmd)); + } + } + break; + case GROUP_SEPARATOR_OPTION: group_separator = optarg; break; diff --git a/src/system.h b/src/system.h index 2a6611e..2266b96 100644 --- a/src/system.h +++ b/src/system.h @@ -129,4 +129,8 @@ __asan_unpoison_memory_region (void const volatile *addr, size_t size) { } # define IGNORE_DUPLICATE_BRANCH_WARNING(exp) exp #endif +#ifndef ARRAY_CARDINALITY +# define ARRAY_CARDINALITY(Array) (sizeof (Array) / sizeof *(Array)) +#endif + #endif -- 2.45.2 --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0002-tests-add-test-for-exclude-vcs.patch >From 94caab87b280b56fb84ac6a495a12616db3124d4 Mon Sep 17 00:00:00 2001 From: Collin Funk Date: Sat, 6 Jul 2024 02:03:54 -0700 Subject: [PATCH 2/2] tests: add test for --exclude-vcs * tests/exclude-vcs: New file. * tests/Makefile.am (TESTS): Add exclude-vcs. --- tests/Makefile.am | 1 + tests/exclude-vcs | 41 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100755 tests/exclude-vcs diff --git a/tests/Makefile.am b/tests/Makefile.am index 9b647c4..3ea34c0 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -109,6 +109,7 @@ TESTS = \ equiv-classes \ ere \ euc-mb \ + exclude-vcs \ false-match-mb-non-utf8 \ fedora \ fgrep-infloop \ diff --git a/tests/exclude-vcs b/tests/exclude-vcs new file mode 100755 index 0000000..8b00533 --- /dev/null +++ b/tests/exclude-vcs @@ -0,0 +1,41 @@ +#!/bin/sh +# Check --exclude-vcs works as expected. + +# Copyright (C) 2024 Free Software Foundation, Inc. + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +. "${srcdir=.}/init.sh"; path_prepend_ ../src + +fail=0 + +# Create VCS directories in the current directory and a child directory. +for directory in CVS RCS .svn .git .hg _darcs; do + mkdir -p "$directory" || framework_failure_ + mkdir -p "x/$directory" || framework_failure_ + echo "abc" > "$directory/file" || framework_failure_ + echo "abc" > "x/$directory/file" || framework_failure_ +done + +grep -r --exclude-vcs 'abc' && fail=1 + +# Create VCS files in the current directory and a child directory. +for file in .gitignore .cvsignore .hgignore; do + echo "abc" > "$file" || framework_failure_ + echo "abc" > "x/$file" || framework_failure_ +done + +grep -r --exclude-vcs 'abc' && fail=1 + +Exit $fail -- 2.45.2 --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Sat Jul 06 09:38:54 2024 Received: (at 42501) by debbugs.gnu.org; 6 Jul 2024 13:38:55 +0000 Received: from localhost ([127.0.0.1]:45733 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sQ5cs-00011E-Lg for submit@debbugs.gnu.org; Sat, 06 Jul 2024 09:38:54 -0400 Received: from mail.cs.ucla.edu ([131.179.128.66]:40244) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sQ5cq-000112-UM for 42501@debbugs.gnu.org; Sat, 06 Jul 2024 09:38:53 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.cs.ucla.edu (Postfix) with ESMTP id 5A8ED3C00E40B; Sat, 6 Jul 2024 06:38:42 -0700 (PDT) Received: from mail.cs.ucla.edu ([127.0.0.1]) by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavis, port 10032) with ESMTP id Hz9wEK12dkzM; Sat, 6 Jul 2024 06:38:42 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by mail.cs.ucla.edu (Postfix) with ESMTP id EBDCA3C00E413; Sat, 6 Jul 2024 06:38:41 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.cs.ucla.edu EBDCA3C00E413 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cs.ucla.edu; s=9D0B346E-2AEB-11ED-9476-E14B719DCE6C; t=1720273122; bh=xTqgsKVYvUzTSkF9gC5foIwz7pDeGcphtbSmS9mrtos=; h=Message-ID:Date:MIME-Version:To:From; b=TWbrKEUBYvlM9u/p72ktXsmAuTsR9Uow8EktXK04Efov2FPBgfuWADs9haJTgNtJc cP5aAxY3TiZgb8ykT0zZ2dS3yz6dwoQjSdQEmtjw2xCuYvKH/FbrKD43ulgeJNnWk1 IuuhX8ZQ8L7tywmMLUAP2fGvsi47LR6m03Hc02amEleBERlB444IPgcJmXmuxrvtsr M8K9gy7O0josws9XzF4xnVtb1gadYkbbDDUO8vaAJlXFQr+xsF8sPMAARNiHdDCGl4 TibPVEoeT9lSY74pl1bY/FfznltIAvkG3oyI8pkJqmas6a+p/qKK9kCyMGEf7TlNFu 12rdMx/weVQcA== X-Virus-Scanned: amavis at mail.cs.ucla.edu Received: from mail.cs.ucla.edu ([127.0.0.1]) by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavis, port 10026) with ESMTP id QbPfGqxjcgiO; Sat, 6 Jul 2024 06:38:41 -0700 (PDT) Received: from [192.168.0.105] (host-85-26-35-49.dynamic.voo.be [85.26.35.49]) by mail.cs.ucla.edu (Postfix) with ESMTPSA id 55E7B3C00E40B; Sat, 6 Jul 2024 06:38:41 -0700 (PDT) Message-ID: <9e2090ac-f516-4dfc-b24e-0ebe0a34ee25@cs.ucla.edu> Date: Sat, 6 Jul 2024 15:38:40 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: bug#42501: feature request: exclude-vcs option To: Collin Funk , 42501@debbugs.gnu.org References: <875xtiga30.fsf@gmail.com> Content-Language: en-US From: Paul Eggert In-Reply-To: <875xtiga30.fsf@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 42501 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) 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. From debbugs-submit-bounces@debbugs.gnu.org Sat Jul 06 16:21:42 2024 Received: (at 42501) by debbugs.gnu.org; 6 Jul 2024 20:21:43 +0000 Received: from localhost ([127.0.0.1]:46802 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sQBug-0003Ds-LS for submit@debbugs.gnu.org; Sat, 06 Jul 2024 16:21:42 -0400 Received: from mail-oi1-f173.google.com ([209.85.167.173]:61618) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sQBue-0003Da-Pu for 42501@debbugs.gnu.org; Sat, 06 Jul 2024 16:21:42 -0400 Received: by mail-oi1-f173.google.com with SMTP id 5614622812f47-3d928b2843dso261194b6e.2 for <42501@debbugs.gnu.org>; Sat, 06 Jul 2024 13:21:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1720297230; x=1720902030; darn=debbugs.gnu.org; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=S5yMuUhMEDRyDrr2JYeg1VyH6Bu1jmgxTwu0LKeXc74=; b=ZbsdU1AzJ3OXqak+hj9Zl41d8FMUVRB+dVY/S0Al1IqjxfSdLSrlgQPazcApA29Hzw HU/l3iAfHETOqSXY9FoKqUA4rlN6Ldgg+jNE0TVAsqHue6+v5sRryj+tAw+TfQ9lI03n xDX0yX56kKEqlQwHRtbjuAMbGZpfwn3OnKMno+TAgOtiE5D4z2D0S+mBe+zYlaGvLuRv 7ztrWThCRXPMgJ+GuyPwR9mU+hLv0LmMi2aRuBWYYctpBI5l0eS5++M1JQoZ3tA7V7An gRDKjaT1x7EpO1yNeF4csu1po8rluabALWH6pdN1ao25kFuZLCu3PKYCUz/1M8y15cA9 IIRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720297230; x=1720902030; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=S5yMuUhMEDRyDrr2JYeg1VyH6Bu1jmgxTwu0LKeXc74=; b=FIxKwq+sFE1R/uDfqIkJMFICxX7fnWOPGRTOy1+9WSyBRrJM8Eyw7zysQckGF5jhpU aV9EE+9sET+HQsHogQZ5S+lnvVTdhCXuDkQDIMA6BEA4vxpAExFzoF+pVi01LxSHjdEy FCGIU9CyRSAOvXtv1pP/EJCFesBcmeSoa4POsDwwrnnjbR9KuG6yOcmEorZpUpechwNM /PeOA+oGtyXUXRdYjjCvoatmh0229IkW4rVlxjVccTNkEgO70TYiXeOxGmTmK34yPo0M I1U4+CYjkRLkxSw5vOJ68m6Sdf+O+z3/v+40o8zAK6PZPI+WVcyR1OJWoqN/m+PKbXWD lZ8A== X-Gm-Message-State: AOJu0Yx7RidirH45ODGHUXOIvy8gyBoAPgZMgkDrbKCrDi54A+8/dkha qgoZG6qExL3K9sOnpAFuw8lldIHz6Cg6SC7fMBFIH6tefCnNeLsDO+wTHQ== X-Google-Smtp-Source: AGHT+IGtL+z/YeIseHsnQ4lJ2fBGbjT4sX8luYTw6x1eG6UQ6TknM3yTTplh5eyG49CeWUNWrEvLAQ== X-Received: by 2002:a05:6808:2218:b0:3d6:8fc:5273 with SMTP id 5614622812f47-3d914c4b25cmr9249002b6e.6.1720297230347; Sat, 06 Jul 2024 13:20:30 -0700 (PDT) Received: from fedora ([2601:646:8002:f840::43a7]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-70af4bb1be5sm6286455b3a.138.2024.07.06.13.20.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Jul 2024 13:20:29 -0700 (PDT) From: Collin Funk To: Paul Eggert Subject: Re: bug#42501: feature request: exclude-vcs option In-Reply-To: <9e2090ac-f516-4dfc-b24e-0ebe0a34ee25@cs.ucla.edu> (Paul Eggert's message of "Sat, 6 Jul 2024 15:38:40 +0200") References: <875xtiga30.fsf@gmail.com> <9e2090ac-f516-4dfc-b24e-0ebe0a34ee25@cs.ucla.edu> Date: Sat, 06 Jul 2024 13:20:28 -0700 Message-ID: <878qyew9v7.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.2 (/) X-Debbugs-Envelope-To: 42501 Cc: 42501@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.8 (/) Hi Paul, Paul Eggert 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 From debbugs-submit-bounces@debbugs.gnu.org Sat Jul 06 17:01:22 2024 Received: (at 42501) by debbugs.gnu.org; 6 Jul 2024 21:01:22 +0000 Received: from localhost ([127.0.0.1]:46834 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sQCX4-0004Er-FT for submit@debbugs.gnu.org; Sat, 06 Jul 2024 17:01:22 -0400 Received: from mail.cs.ucla.edu ([131.179.128.66]:43518) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sQCX2-0004Ed-5Z for 42501@debbugs.gnu.org; Sat, 06 Jul 2024 17:01:21 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.cs.ucla.edu (Postfix) with ESMTP id 3A0EE3C00E413; Sat, 6 Jul 2024 14:01:10 -0700 (PDT) Received: from mail.cs.ucla.edu ([127.0.0.1]) by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavis, port 10032) with ESMTP id rsDBPsdQP5fZ; Sat, 6 Jul 2024 14:01:05 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by mail.cs.ucla.edu (Postfix) with ESMTP id D6B583C00E414; Sat, 6 Jul 2024 14:01:05 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.cs.ucla.edu D6B583C00E414 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cs.ucla.edu; s=9D0B346E-2AEB-11ED-9476-E14B719DCE6C; t=1720299665; bh=NbuyEKvUp6sZlhsxCW3IxtZ/RY7LY+KgTcC0aF9HJh0=; h=Message-ID:Date:MIME-Version:To:From; b=c4i3J9yu/BpqbikhdCvWeipIDU7H1b8rF9ZS/Dxra86Lnf4ELPb9gvJPRneIQHCCy +86qB0E7/nU3PToNav2lIdSJyRd2KxdMxvdwn/u4Xsavf5KG1vkPIUEM+uPV6vvz0t IPJc463QWF1jwm+aB2J0avdGNx1XkzUSR/tJvzSGbwtosHK3lW7H0AZcvZ/ms/B4KC CkUpj+GTmqj67ZApIIurQR8utxBs6cBE5ybschPtJjm18qIbUGJk4Xbx5088iuaoNv 0Dq+nu1f5EaG67ZstC4M1gTL3AxHiZhS9G/9CC4XPcW6vqJ2TSP0FjG5ERikekYS1n LYKjhnvwzY96g== X-Virus-Scanned: amavis at mail.cs.ucla.edu Received: from mail.cs.ucla.edu ([127.0.0.1]) by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavis, port 10026) with ESMTP id C8kIwkc4rX0s; Sat, 6 Jul 2024 14:01:05 -0700 (PDT) Received: from [192.168.0.105] (host-85-26-35-49.dynamic.voo.be [85.26.35.49]) by mail.cs.ucla.edu (Postfix) with ESMTPSA id 2C1BC3C00E413; Sat, 6 Jul 2024 14:01:04 -0700 (PDT) Message-ID: <50a1ef5f-b91f-4fbf-89ab-75c331c28690@cs.ucla.edu> Date: Sat, 6 Jul 2024 23:01:03 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: bug#42501: feature request: exclude-vcs option To: Collin Funk References: <875xtiga30.fsf@gmail.com> <9e2090ac-f516-4dfc-b24e-0ebe0a34ee25@cs.ucla.edu> <878qyew9v7.fsf@gmail.com> Content-Language: en-US From: Paul Eggert In-Reply-To: <878qyew9v7.fsf@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 42501 Cc: 42501@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) 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. From debbugs-submit-bounces@debbugs.gnu.org Sat Jul 06 17:15:57 2024 Received: (at 42501) by debbugs.gnu.org; 6 Jul 2024 21:15:57 +0000 Received: from localhost ([127.0.0.1]:46881 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sQClB-0004b7-Gw for submit@debbugs.gnu.org; Sat, 06 Jul 2024 17:15:57 -0400 Received: from mail-yb1-f173.google.com ([209.85.219.173]:43077) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sQCl4-0004ao-Hr for 42501@debbugs.gnu.org; Sat, 06 Jul 2024 17:15:55 -0400 Received: by mail-yb1-f173.google.com with SMTP id 3f1490d57ef6-e0360f890a1so2958797276.0 for <42501@debbugs.gnu.org>; Sat, 06 Jul 2024 14:15:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1720300481; x=1720905281; darn=debbugs.gnu.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :reply-to:in-reply-to:references:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=prBdLxLCIqHaydm4L4ygtMveSKYbPtsnnEHuqqk1hLw=; b=VQVWI8xaKN1UlEbjeVM5N2BhsVhlb1dpC/w/6a75dG5IwthAawzYGYdM6VHl8wJBdj CU77uA+Gr3+WIfRlVX3K5ZI5W9yEMrU+Q/XhV5yOp67RSyby48k1DzKSxL5yp1swkMpx QlwJw8dPJbyRgMybPVnJLMHt+K1+bauE0exTreVPZ6lfHqI9BqsrcFcWV1YLsFe1k3HA +i2ozgp4Ll6t6kOeN+ZZfryrvtGaJcwSatm9wfoGy2jyRMl4baV1EV8cyMqkiBsa3jmW +G+JJkOi8skAIBvYMqEbaZkFBvAwMPEMxXgiVEBWdb5B9+8GIcejaSlKQAE8ylmlrypE dwDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720300481; x=1720905281; h=content-transfer-encoding:cc:to:subject:message-id:date:from :reply-to:in-reply-to:references:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=prBdLxLCIqHaydm4L4ygtMveSKYbPtsnnEHuqqk1hLw=; b=d4p6lSZidgootZGR28APMWKhpO2LsrUYqdw5xgksZX5JaO0yxzpnmxUBvqlizN5K/D VU0V+wgKNVkZqsHMniSCmvbcU/z+zbmpA/gpFdBLYkaYlUNqfo9zcTLe4VLuMcRQSwr1 jys6SIheQuqcQm9GU6/sf2MrMAOuxP7w1NCGJMQXUhNejYWt1YVPgDmPK2WC1TzO+fxe 2pLUmN+AlUcYkztmks28oeDvk+l+9YA7zLW7hfuc9YzMbTb1s5zpVMTD+RkfrH+rErc5 6Xnl4Alz9yFe4sU6PsgXTEgIV8uL6ajvc5qGQJYjANs8FZngy/b/BdJsl2st4eUtc3ow 3LUA== X-Gm-Message-State: AOJu0YyARODxT3rS2owmCJYVjZereKqCO+g0+i8AuzaPtDMBXpOzQ0ET YjqN6SPniVtSsk+TH/h72leI9mdDVMXJDvcqnpT3kPp29P64DaFPeC4gq7XgkAk/kC9ykBNt6Xz JA8q7M3D7pWYTKmxVJXF/BmM2pGY= X-Google-Smtp-Source: AGHT+IGpr7QL5CHM6QaPr4M7TbtZyAfjTakG7RNQRsKs8UoptwEThLDSgS2Ckmvciz5L+0C+GAtQwWqkvDW40ig4+Ac= X-Received: by 2002:a25:7e04:0:b0:e03:61cf:a9f4 with SMTP id 3f1490d57ef6-e03c2a1e1c5mr4580288276.16.1720300480951; Sat, 06 Jul 2024 14:14:40 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Jeffrey Walton Date: Sat, 6 Jul 2024 17:14:04 -0400 Message-ID: Subject: Re: bug#42501: feature request: exclude-vcs option To: Steve Ward Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 42501 Cc: 42501@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: noloader@gmail.com Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On Thu, Jul 23, 2020 at 9:33=E2=80=AFPM Steve Ward wro= te: > > 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=3D.bzr --exclude-dir=3DCVS --exclude-dir=3D.git > --exclude-dir=3D.hg --exclude-dir=3D.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