GNU bug report logs - #18641
[PATCH] diff: Add --only=REGEX option to parse only files that match REGEX

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: diffutils; Reported by: Daniel Hilst Selli <danielhilst@HIDDEN>; Keywords: patch; dated Sun, 5 Oct 2014 23:28:01 UTC; Maintainer for diffutils is bug-diffutils@HIDDEN.

Message received at 18641 <at> debbugs.gnu.org:


Received: (at 18641) by debbugs.gnu.org; 6 Oct 2014 17:06:24 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Oct 06 13:06:24 2014
Received: from localhost ([127.0.0.1]:35964 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1XbBjr-0008Mr-Pt
	for submit <at> debbugs.gnu.org; Mon, 06 Oct 2014 13:06:24 -0400
Received: from mail-qa0-f46.google.com ([209.85.216.46]:50746)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <danielhilst@HIDDEN>) id 1XbBjq-0008Mj-BI
 for 18641 <at> debbugs.gnu.org; Mon, 06 Oct 2014 13:06:22 -0400
Received: by mail-qa0-f46.google.com with SMTP id w8so3781403qac.33
 for <18641 <at> debbugs.gnu.org>; Mon, 06 Oct 2014 10:06:21 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
 h=message-id:date:from:user-agent:mime-version:to:cc:subject
 :references:in-reply-to:content-type:content-transfer-encoding;
 bh=e/W1WtfkttejBmU8A5re8KkLdItHqcy7fgnoJxV/4ck=;
 b=ki+MPGw/2vSitsDsVcyDlwsVyLEw4VHptklbGSAwBemWhcyOkFOD2iAD4FEtvTegKQ
 aRsVsI3enSCL4m1uyr3qr/if3EFxloVvd8cVN0J5/1l4jyFjynztGQ5xKxTUjjnkygPg
 tJXsdXpmy9+EebXPI/b2XbNjgA7hwnW6XnK5W45oNwv8Ib7v4uaaFEwfALR9XYeN7Q8B
 0TEmLxeoaEiiEX8L/1cqDoPqsPta/y/Q/X8LCNX2l/lOfQbjHwdnWSsSmeUbi9KwLc6C
 WCd1+OB8YhOOyA0eX6C+u1DZgBrZenTU/SCzvwCAyc3lTPOWvET/w4w2nwboXDpso7+o
 0Xqg==
X-Received: by 10.224.88.137 with SMTP id a9mr12244963qam.88.1412615181761;
 Mon, 06 Oct 2014 10:06:21 -0700 (PDT)
Received: from [155.1.1.163] ([187.11.221.17])
 by mx.google.com with ESMTPSA id b1sm13009753qat.9.2014.10.06.10.06.20
 for <multiple recipients>
 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
 Mon, 06 Oct 2014 10:06:21 -0700 (PDT)
Message-ID: <5432CBDE.4080605@HIDDEN>
Date: Mon, 06 Oct 2014 14:05:34 -0300
From: Daniel Hilst Selli <danielhilst@HIDDEN>
User-Agent: Mozilla/5.0 (X11; Linux x86_64;
 rv:31.0) Gecko/20100101 Thunderbird/31.1.0
MIME-Version: 1.0
To: 18641 <at> debbugs.gnu.org
Subject: Re: [bug-diffutils] bug#18641: bug#18641: [PATCH] diff: Add
 --only=REGEX option to parse only files that match REGEX
References: <1412539537-7660-1-git-send-email-danielhilst@HIDDEN>	<54328ED0.9090403@HIDDEN>	<5432C455.90307@HIDDEN>
 <CAHpGcMKi7CM5RQfNqwcj=2H6s201Nx2p03qn7ZtVXJ2vYo9CTQ@HIDDEN>
In-Reply-To: <CAHpGcMKi7CM5RQfNqwcj=2H6s201Nx2p03qn7ZtVXJ2vYo9CTQ@HIDDEN>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 18641
Cc: =?UTF-8?B?QW5kcmVhcyBHcsO8bmJhY2hlcg==?= <agruen@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.7 (/)

On 10/06/2014 01:53 PM, Andreas Grünbacher wrote:
> 2014-10-06 18:33 GMT+02:00 Daniel Hilst Selli <danielhilst@HIDDEN>:
>> I would need to find every file that, exist on one tree and not on
>> another. This mean getting a list of files on two trees and comparing, what
>> is complex, error prone and slower.
>
> See my posting from before on how this can be done relatively easily ...
>
> Andreas
>
I saw it, its a nice xargs trick, I never thought about sorting find output,
I was trying find -exec solutions, this is really nice :-)

Regards,




Information forwarded to bug-diffutils@HIDDEN:
bug#18641; Package diffutils. Full text available.

Message received at 18641 <at> debbugs.gnu.org:


Received: (at 18641) by debbugs.gnu.org; 6 Oct 2014 16:34:16 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Oct 06 12:34:15 2014
Received: from localhost ([127.0.0.1]:35952 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1XbBEl-0007XY-82
	for submit <at> debbugs.gnu.org; Mon, 06 Oct 2014 12:34:15 -0400
Received: from mail-qg0-f47.google.com ([209.85.192.47]:47333)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <danielhilst@HIDDEN>) id 1XbBEj-0007XQ-Kt
 for 18641 <at> debbugs.gnu.org; Mon, 06 Oct 2014 12:34:14 -0400
Received: by mail-qg0-f47.google.com with SMTP id i50so3974802qgf.34
 for <18641 <at> debbugs.gnu.org>; Mon, 06 Oct 2014 09:34:13 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
 h=message-id:date:from:user-agent:mime-version:to:subject:references
 :in-reply-to:content-type:content-transfer-encoding;
 bh=3UmCS1q8Lr24stDvQfqSIap06y1rSzilpbhKXu5Mk1k=;
 b=p1novMPy4IfGdIrkcDa7lT5L2WWKU2L5PoZ9ilc8Yi5sHK53lCU/RMREpwYcL60Xb0
 nt8A69FKRv0TKPGAqbe5qn2Agw79tSJTPSkzmsp2SN3LOeBSuMczIGtbZHpZ3321vd3o
 K3np82ojIMOeAykeLXRolIgJNYOkc8n4WyWvkjh5nSW4vxA5uGwKdsOVK8xglXAGvZuO
 M4JJv04aDRL/Xb/kQ9f+QUuZrbaqDbvAnUDjd1Cl0q/s3LlFvYwvA5ygzJdhcdgqC3yD
 PYt5kRHMjmXmeIL9lV0cgfkgaZ1pu7t0aHkI+Y/jcb0J3NWqDHb3Ef2b2KQdqYx/1Iru
 hqKw==
X-Received: by 10.140.90.42 with SMTP id w39mr10926154qgd.88.1412613252989;
 Mon, 06 Oct 2014 09:34:12 -0700 (PDT)
Received: from [155.1.1.163] ([187.11.221.17])
 by mx.google.com with ESMTPSA id l2sm1993829qao.34.2014.10.06.09.34.11
 for <18641 <at> debbugs.gnu.org>
 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
 Mon, 06 Oct 2014 09:34:12 -0700 (PDT)
Message-ID: <5432C455.90307@HIDDEN>
Date: Mon, 06 Oct 2014 13:33:25 -0300
From: Daniel Hilst Selli <danielhilst@HIDDEN>
User-Agent: Mozilla/5.0 (X11; Linux x86_64;
 rv:31.0) Gecko/20100101 Thunderbird/31.1.0
MIME-Version: 1.0
To: 18641 <at> debbugs.gnu.org
Subject: Re: [bug-diffutils] bug#18641: [PATCH] diff: Add --only=REGEX option
 to parse only files that match REGEX
References: <1412539537-7660-1-git-send-email-danielhilst@HIDDEN>
 <54328ED0.9090403@HIDDEN>
In-Reply-To: <54328ED0.9090403@HIDDEN>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 18641
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.7 (/)

On 10/06/2014 09:45 AM, Eric Blake wrote:
> On 10/05/2014 02:05 PM, Daniel Hilst Selli wrote:
>> I run to this problem some time ago. I need to parse to trees, but
>> only the source files (*.[hcS]). I see some find solutions, but that
>> don't work for me since I have new files created on modified
>> tree. Best solution would be patch diff. So here I am.
> This feels like feature bloat.  What's wrong with using 'find' to locate
> the subset of files you are interested in, then running diff on those files?
>

I would need to find every file that, exist on one tree and not on
another. This mean getting a list of files on two trees and comparing, what is complex,
error prone and slower.





Information forwarded to bug-diffutils@HIDDEN:
bug#18641; Package diffutils. Full text available.

Message received at 18641 <at> debbugs.gnu.org:


Received: (at 18641) by debbugs.gnu.org; 6 Oct 2014 14:15:41 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Oct 06 10:15:41 2014
Received: from localhost ([127.0.0.1]:35862 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1Xb94d-00041s-AC
	for submit <at> debbugs.gnu.org; Mon, 06 Oct 2014 10:15:40 -0400
Received: from mail-ob0-f180.google.com ([209.85.214.180]:59637)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <andreas.gruenbacher@HIDDEN>) id 1Xb94a-00041h-9h
 for 18641 <at> debbugs.gnu.org; Mon, 06 Oct 2014 10:15:36 -0400
Received: by mail-ob0-f180.google.com with SMTP id va2so3894246obc.39
 for <18641 <at> debbugs.gnu.org>; Mon, 06 Oct 2014 07:15:35 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
 h=mime-version:sender:in-reply-to:references:date:message-id:subject
 :from:to:cc:content-type;
 bh=wbNTUVqu5YMLpShyWibGpEfZ81DTm8wFZ9+cHkfyrK0=;
 b=Irz3ElwN5vBSPl3uTRPU/y8V47HwofKESOqg5xUZ2uBq7/4ma553mCaMsgNpyK5LNA
 GqBgA1EaqtzBSLsAS2JNwTg7t9kyFKUFcGlRVHJqoNnlQLM/iqNP29dGCtQhwYJ5Lo+V
 hWCchsiBWSVLYkYHFz6x2Qqqwxew8WlrsQzXxS2/tYGbkvSAmmEvUWso0R/7wW30TegG
 9Xet3t6KCMGT5GDVmyIov0LVDhYvJu5jYv47yC38n50ni1Ka64JaNaDpbnjqreP/1yGm
 sm+UiG/bIAy7SzgcxVBfjI1Fbmqg9OYrTjIhllct1KaCQqyajqUimF9xl+dJI0jy523y
 Lb4Q==
MIME-Version: 1.0
X-Received: by 10.60.245.101 with SMTP id xn5mr28196445oec.27.1412604935514;
 Mon, 06 Oct 2014 07:15:35 -0700 (PDT)
Received: by 10.182.87.104 with HTTP; Mon, 6 Oct 2014 07:15:35 -0700 (PDT)
In-Reply-To: <54328ED0.9090403@HIDDEN>
References: <1412539537-7660-1-git-send-email-danielhilst@HIDDEN>
 <54328ED0.9090403@HIDDEN>
Date: Mon, 6 Oct 2014 16:15:35 +0200
X-Google-Sender-Auth: EcR6OIkq5SFuj2gD8R8zcnKO6F4
Message-ID: <CAHpGcM+FPeuGZrBMHJFasSvNPNsPh_X_L075+uems6WfaKa3Pg@HIDDEN>
Subject: Re: [bug-diffutils] bug#18641: bug#18641: [PATCH] diff: Add
 --only=REGEX option to parse only files that match REGEX
From: =?UTF-8?Q?Andreas_Gr=C3=BCnbacher?= <agruen@HIDDEN>
To: Eric Blake <eblake@HIDDEN>
Content-Type: text/plain; charset=UTF-8
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 18641
Cc: Daniel Hilst Selli <danielhilst@HIDDEN>, 18641 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.7 (/)

2014-10-06 14:45 GMT+02:00 Eric Blake <eblake@HIDDEN>:
> This feels like feature bloat.  What's wrong with using 'find' to locate
> the subset of files you are interested in, then running diff on those files?

It's a bit messy to work around with find:

  find a/ b/ -type f -printf "%P\0" | sort -zu | xargs -0 -n1 -i% diff
-Nu a/% b/%

Daniel's proposed feature makes this easier and more efficient (as diff won't
be invoked for each file), so it looks good to me.

Thanks,
Andreas




Information forwarded to bug-diffutils@HIDDEN:
bug#18641; Package diffutils. Full text available.

Message received at 18641 <at> debbugs.gnu.org:


Received: (at 18641) by debbugs.gnu.org; 6 Oct 2014 12:45:11 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Oct 06 08:45:11 2014
Received: from localhost ([127.0.0.1]:35320 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1Xb7f4-0001pi-D5
	for submit <at> debbugs.gnu.org; Mon, 06 Oct 2014 08:45:10 -0400
Received: from mx1.redhat.com ([209.132.183.28]:16061)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <eblake@HIDDEN>) id 1Xb7f1-0001pY-5n
 for 18641 <at> debbugs.gnu.org; Mon, 06 Oct 2014 08:45:08 -0400
Received: from int-mx10.intmail.prod.int.phx2.redhat.com
 (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23])
 by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s96Cj5aj019959
 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL);
 Mon, 6 Oct 2014 08:45:05 -0400
Received: from [10.3.113.126] (ovpn-113-126.phx2.redhat.com [10.3.113.126])
 by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id
 s96Cj4nL015402; Mon, 6 Oct 2014 08:45:04 -0400
Message-ID: <54328ED0.9090403@HIDDEN>
Date: Mon, 06 Oct 2014 06:45:04 -0600
From: Eric Blake <eblake@HIDDEN>
Organization: Red Hat, Inc.
User-Agent: Mozilla/5.0 (X11; Linux x86_64;
 rv:31.0) Gecko/20100101 Thunderbird/31.1.1
MIME-Version: 1.0
To: Daniel Hilst Selli <danielhilst@HIDDEN>, 18641 <at> debbugs.gnu.org
Subject: Re: [bug-diffutils] bug#18641: [PATCH] diff: Add --only=REGEX option
 to parse only files that match REGEX
References: <1412539537-7660-1-git-send-email-danielhilst@HIDDEN>
In-Reply-To: <1412539537-7660-1-git-send-email-danielhilst@HIDDEN>
OpenPGP: url=http://people.redhat.com/eblake/eblake.gpg
Content-Type: multipart/signed; micalg=pgp-sha256;
 protocol="application/pgp-signature";
 boundary="B9b4KaiK7L8M0Tu9QFX2gX1iJP3UOaV2q"
X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23
X-Spam-Score: -5.0 (-----)
X-Debbugs-Envelope-To: 18641
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -5.0 (-----)

This is an OpenPGP/MIME signed message (RFC 4880 and 3156)
--B9b4KaiK7L8M0Tu9QFX2gX1iJP3UOaV2q
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

On 10/05/2014 02:05 PM, Daniel Hilst Selli wrote:
> I run to this problem some time ago. I need to parse to trees, but
> only the source files (*.[hcS]). I see some find solutions, but that
> don't work for me since I have new files created on modified
> tree. Best solution would be patch diff. So here I am.

This feels like feature bloat.  What's wrong with using 'find' to locate
the subset of files you are interested in, then running diff on those fil=
es?

--=20
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


--B9b4KaiK7L8M0Tu9QFX2gX1iJP3UOaV2q
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
Comment: Public key at http://people.redhat.com/eblake/eblake.gpg

iQEcBAEBCAAGBQJUMo7QAAoJEKeha0olJ0NqvkEH/3yPMrIx5vCoAYj6mAnnuKBh
Wwpq7OkCUzKV6jHLNgcXbPJnx2YHAoMMJfFGTW0Cb+fqUSvthn3H2v3ZDvARn7rI
P8cEtGTIudRRXFldakfymirDw5zu00dKIVqx+/l2nUp9ChKyANNd/6ht0kBVBFrT
Pvfg94HuIN+CKaxuZWInz4ew9x5rHmLc9afL4w3ykw3VXQ4gZDH8AFoqzk4ov+At
cIk3IsNpMKpnGn758lIdhJ0ulwfm0DwTXt5I1D1owU5f4H2+q/wBBqdfLt6YAnYV
RKAcs0gJ5XmhkrfEkQ1ZOMW67BuhCtEm79oNkexXygoZ0+cGDZ3aPov1ph2Wvck=
=Rf8z
-----END PGP SIGNATURE-----

--B9b4KaiK7L8M0Tu9QFX2gX1iJP3UOaV2q--




Information forwarded to bug-diffutils@HIDDEN:
bug#18641; Package diffutils. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 5 Oct 2014 23:27:03 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Oct 05 19:27:03 2014
Received: from localhost ([127.0.0.1]:35098 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1XavCg-0004N8-Bt
	for submit <at> debbugs.gnu.org; Sun, 05 Oct 2014 19:27:03 -0400
Received: from eggs.gnu.org ([208.118.235.92]:50319)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <danielhilst@HIDDEN>) id 1XauuX-0003tn-92
 for submit <at> debbugs.gnu.org; Sun, 05 Oct 2014 19:08:18 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <danielhilst@HIDDEN>) id 1XauuN-0000DI-U7
 for submit <at> debbugs.gnu.org; Sun, 05 Oct 2014 19:08:16 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: **
X-Spam-Status: No, score=2.4 required=5.0 tests=BAYES_50,DATE_IN_PAST_03_06,
 FREEMAIL_FROM,T_DKIM_INVALID autolearn=disabled version=3.3.2
Received: from lists.gnu.org ([2001:4830:134:3::11]:43643)
 by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <danielhilst@HIDDEN>) id 1XauuN-0000DE-Q7
 for submit <at> debbugs.gnu.org; Sun, 05 Oct 2014 19:08:07 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:51957)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <danielhilst@HIDDEN>) id 1XauuE-0007sL-Mu
 for bug-diffutils@HIDDEN; Sun, 05 Oct 2014 19:08:07 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <danielhilst@HIDDEN>) id 1Xauu5-00006q-JI
 for bug-diffutils@HIDDEN; Sun, 05 Oct 2014 19:07:58 -0400
Received: from mail-qg0-x22f.google.com ([2607:f8b0:400d:c04::22f]:53147)
 by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <danielhilst@HIDDEN>) id 1Xauu5-00006Y-90
 for bug-diffutils@HIDDEN; Sun, 05 Oct 2014 19:07:49 -0400
Received: by mail-qg0-f47.google.com with SMTP id i50so3041178qgf.34
 for <bug-diffutils@HIDDEN>; Sun, 05 Oct 2014 16:07:48 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
 h=from:to:cc:subject:date:message-id;
 bh=gjyTfL+tGGI5mX6pnQ1O21hlNq/7Y9b0pEAKrqsAuds=;
 b=ZJgcVff7LXijobwGqcRZKjCypwONqwkxpR3xkG/KBeh8I9oKqmjyd8PZwQp+ytkMN/
 V+MfoQIMmDLJE5iJwAABDVjS6c/5WeB3pdJpJbuAMFOoAtCX3yZweopJGbEw4hQjUy3Q
 fc5sW9PTmQbTDbiN2rUzKPP8wLvkMvvQ62nCCM3e5caiCfIeA4xHe+8cktKV7IAlAWMI
 AU42RLLgYVmn7VMIs46K1HBljqzSA5ZvgNBNaD4hPzQUDTT9wqzxxVa3JeIJ61yq1qqj
 GGQW7Qnb3mSx96OFEsB8gQ7OOUy1mujl4I+VnygPWyPWkXsiBHQJcty5Dk37PSeQp0R9
 a34g==
X-Received: by 10.224.32.138 with SMTP id c10mr26533307qad.1.1412550467997;
 Sun, 05 Oct 2014 16:07:47 -0700 (PDT)
Received: from localhost.localdomain ([189.102.8.179])
 by mx.google.com with ESMTPSA id g5sm11287755qaz.39.2014.10.05.16.07.46
 for <multiple recipients>
 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128);
 Sun, 05 Oct 2014 16:07:47 -0700 (PDT)
From: Daniel Hilst Selli <danielhilst@HIDDEN>
To: bug-diffutils@HIDDEN
Subject: [PATCH] diff: Add --only=REGEX option to parse only files that match
 REGEX
Date: Sun,  5 Oct 2014 20:05:37 +0000
Message-Id: <1412539537-7660-1-git-send-email-danielhilst@HIDDEN>
X-Mailer: git-send-email 2.1.2
X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address
 (bad octet value).
X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address
 (bad octet value).
X-Received-From: 2001:4830:134:3::11
X-Spam-Score: -2.9 (--)
X-Debbugs-Envelope-To: submit
X-Mailman-Approved-At: Sun, 05 Oct 2014 19:27:00 -0400
Cc: Daniel Hilst Selli <danielhilst@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.9 (--)

I run to this problem some time ago. I need to parse to trees, but
only the source files (*.[hcS]). I see some find solutions, but that
don't work for me since I have new files created on modified
tree. Best solution would be patch diff. So here I am.

This patches add a new option (--only=REGEX) that parse only files
that match such regexp. Multiple regexps can be used and they will be
OR'ed. Also, --exclude is processed before --only, so will can still
exclude files before they match REGEX.

This commit don't update man pages and info docs, I looking for it.

Cheers,
>8---------------------8<
* src/diff.h: XTERN only_regexp added.
* src/diff.c: global only_regexp_list, and ONLY_OPTION added.
              "only-that-matches" element added to longopts.
              Help string added to global option_help_msgid array.
* src/diff.c: (main) only_regexp_list.buf initalized.
              ONLY_OPITON processed on options loop
* src/dir.c:  (dir_read) Added an `if' to process --only option. Was
              added after --exclude processing. This way user can
              exclude files that still match --only REGEX.
---
 src/diff.c | 12 ++++++++++++
 src/diff.h |  3 +++
 src/dir.c  | 10 ++++++++++
 3 files changed, 25 insertions(+)

diff --git a/src/diff.c b/src/diff.c
index 397815e..003eb59 100644
--- a/src/diff.c
+++ b/src/diff.c
@@ -84,6 +84,9 @@ static struct regexp_list function_regexp_list;
 /* Ignore changes affecting only lines that match these regexps.  */
 static struct regexp_list ignore_regexp_list;
 
+/* Parse only files that match this regexp. */
+static struct regexp_list only_regexp_list;
+
 #if O_BINARY
 /* Use binary I/O when reading and writing data (--binary).
    On POSIX hosts, this has no effect.  */
@@ -126,6 +129,7 @@ enum
   SUPPRESS_COMMON_LINES_OPTION,
   TABSIZE_OPTION,
   TO_FILE_OPTION,
+  ONLY_OPTION,
 
   /* These options must be in sequence.  */
   UNCHANGED_LINE_FORMAT_OPTION,
@@ -191,6 +195,7 @@ static struct option const longopts[] =
   {"normal", 0, 0, NORMAL_OPTION},
   {"old-group-format", 1, 0, OLD_GROUP_FORMAT_OPTION},
   {"old-line-format", 1, 0, OLD_LINE_FORMAT_OPTION},
+  {"only-that-matches", 1, 0, ONLY_OPTION},
   {"paginate", 0, 0, 'l'},
   {"rcs", 0, 0, 'n'},
   {"recursive", 0, 0, 'r'},
@@ -282,6 +287,7 @@ main (int argc, char **argv)
   c_stack_action (0);
   function_regexp_list.buf = &function_regexp;
   ignore_regexp_list.buf = &ignore_regexp;
+  only_regexp_list.buf = &only_regexp;
   re_set_syntax (RE_SYNTAX_GREP | RE_NO_POSIX_BACKTRACKING);
   excluded = new_exclude ();
 
@@ -609,6 +615,10 @@ main (int argc, char **argv)
 	  specify_value (&to_file, optarg, "--to-file");
 	  break;
 
+        case ONLY_OPTION:
+          add_regexp (&only_regexp_list, optarg);
+          break;
+
 	case UNCHANGED_LINE_FORMAT_OPTION:
 	case OLD_LINE_FORMAT_OPTION:
 	case NEW_LINE_FORMAT_OPTION:
@@ -696,6 +706,7 @@ main (int argc, char **argv)
 
   summarize_regexp_list (&function_regexp_list);
   summarize_regexp_list (&ignore_regexp_list);
+  summarize_regexp_list (&only_regexp_list);
 
   if (output_style == OUTPUT_IFDEF)
     {
@@ -883,6 +894,7 @@ static char const * const option_help_msgid[] = {
   N_("    --no-ignore-file-name-case  consider case when comparing file names"),
   N_("-x, --exclude=PAT               exclude files that match PAT"),
   N_("-X, --exclude-from=FILE         exclude files that match any pattern in FILE"),
+  N_("    --only=REGEX                only parse files that match REGEX"),
   N_("-S, --starting-file=FILE        start with FILE when comparing directories"),
   N_("    --from-file=FILE1           compare FILE1 to all operands;\n"
      "                                  FILE1 can be a directory"),
diff --git a/src/diff.h b/src/diff.h
index e9f0471..1df36f9 100644
--- a/src/diff.h
+++ b/src/diff.h
@@ -145,6 +145,9 @@ XTERN char *file_label[2];
 /* Regexp to identify function-header lines (-F).  */
 XTERN struct re_pattern_buffer function_regexp;
 
+/* Parse only file that match this regexp (--only) */
+XTERN struct re_pattern_buffer only_regexp;
+
 /* Ignore changes that affect only lines matching this regexp (-I).  */
 XTERN struct re_pattern_buffer ignore_regexp;
 
diff --git a/src/dir.c b/src/dir.c
index d3b0a2d..5fcd06f 100644
--- a/src/dir.c
+++ b/src/dir.c
@@ -99,6 +99,16 @@ dir_read (struct file_data const *dir, struct dirdata *dirdata)
 	  if (excluded_file_name (excluded, d_name))
 	    continue;
 
+          if (only_regexp.fastmap)
+            {
+              int only_match = re_search (&only_regexp, d_name, d_size, 0, d_size, NULL);
+
+              if (-1 == only_match)
+                continue;
+              else if (-2 == only_match)
+                fatal("Error while matching --only option");
+            }
+
 	  while (data_alloc < data_used + d_size)
 	    {
 	      if (PTRDIFF_MAX / 2 <= data_alloc)
-- 
2.1.2





Acknowledgement sent to Daniel Hilst Selli <danielhilst@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-diffutils@HIDDEN. Full text available.
Report forwarded to bug-diffutils@HIDDEN:
bug#18641; Package diffutils. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Mon, 25 Nov 2019 12:00:02 UTC

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