Subject: Re: [bug-diffutils] bug#15452: Comparing files whose name _do_ match a certain pattern

From: Dani Moncayo <[email-masked]>
Date: Tue, 24 Sep 2013 19:25:39 +0200

On Tue, Sep 24, 2013 at 4:46 PM, Dani Moncayo <[email-masked]> wrote:
> On Tue, Sep 24, 2013 at 4:34 PM, Dani Moncayo <[email-masked]> wrote:
>>> Ah, but why should we bloat diff when find already gives you what you want:
>>>
>>> find . -name '*.txt' -exec diff {} other/{} \;
>>>
>>> will run diff on only files ending in *.txt, when comparing . against
>>> other/.
>>
>> Ah yes, that's one possibility for doing what I want, but I'd
>> definitely prefer having the "--include" option, because:
>>
>> 1. Simplicity: It would be a lot simpler than the find/diff
>> combination.  And in the probable case that the "old" directory to
>> compare is not the current working directory, things get even more
>> complex, because the files in the "new" directory could not be
>> expressed in such a simple way ("whatever/{}").
>>
>> 2. Consistency: Why not having an "--include" option when we have an
>> "--exclude" option?
>
> Another reason comes to my mind:
>
> 3.  Flexibility: Having the possibility of combining "--include" and
> "--exclude" would be quite convenient in some cases.  It would be a
> simple way of expressing the intersection of two sets of files.

Another one:

4. Consistency (II): "grep" has exactly what I'm requesting for "diff":

      --include=FILE_PATTERN  search only files that match FILE_PATTERN
      --exclude=FILE_PATTERN  skip files and directories matching FILE_PATTERN

-- 
Dani Moncayo