Re: [RFC] git diff dira dirb file ...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Daniel Barkalow <barkalow@xxxxxxxxxxxx> writes:

> After a lot of trying, I finally found something that git diff doesn't 
> handle. If you've got two trees of files with the same general structure, 
> even if they aren't at all git-related, you can use:
>
> $ git diff dira dirb
>
> to get a nice diff between them. But then it would be intuitive and useful 
> to be able to restrict by path the files within those directories that you 
> want to compare (much like "git diff origin master file1 file2 ...") with:
>
> $ git diff dira dirb file1 file2
>
> That would, of course, compare dira/file1 with dirb/file1 and dira/file2 
> with dirb/file2. Before I start looking into implementing this, is it 
> incoherent for some reason I'm not seeing?

Incoherent?

I do not see anything fundamentally wrong with it, except that command
line parsing may get tricky, because we rely on the revision command line
parser, and logically you should be able to spell the above commandline as
"diff dira dirb -- file1 file2", revision parser wants anything that comes
before -- to be revisions, not paths.

Just make sure that you got two directories, at least one of which is
outside the work tree, mark your diff option as "no-index", then walk the
two directories in parallel to populate the diff_queue().  Once you are
done walking, let diffcore_std() to do its usual thing.

Having said that, that new "feature" is not git anymore, and I'd rather
wish to see competent git people to be working on hunting for and fixing
outstanding bugs during the -rc period, than spending their time on new
features and non-git hacking, but all of us do this as hobbies, so I
wouldn't stop you ;-)

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux