Thread (2 messages) flat view 2 messages, 2 authors, 2016-06-15

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

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:44:42

Daniel Barkalow [off-list ref] 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 ;-)
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help