Re: git difftool does does not respect current working directory

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

 



Hello,

On Sun, May 15, 2011 at 10:39:18PM -0700, Junio C Hamano wrote:
> FrÃdÃric Heitzmann  <frederic.heitzmann@xxxxxxxxx> writes:
> 
> > Unfortunately, 'git difftool' does not keep the current working directory while
> > launching gvimdiff.
> >
> > => Is it done on purpose ?
> > If not, it is probably a good idea to fix this.
> 
> I will not comment on "on purpose?" part, as I do not use difftool myself.
> 
> But the right set of questions to ask is not the above, but these:
> 
>  - Is it on purpose that difftool runs its diff viewer from the top of the
>    working tree?
> 
>  - Is there any existing user who depends on that current behaviour?  IOW,
>    would anybody suffer if difftool suddenly starts to run the diff viewer
>    from the subdirectory that the user started "git difftool" from?
> 
> If the answers to both of them are No, then it might be a good idea to
> change the behaviour.

Another thing to consider is ensuring that there is a
consistency between 'diff' and 'difftool'.

When you run 'git diff' from a subdirectory git will show you
a diff against the entire tree.  In this respect, 'difftool' is
consistent.  In that sense, yes, this is very much "on purpose".

Is there something that isn't working because of the internal
chdir?  I'm not sure if you want to change the chdir behavior
for aesthetic purposes or if there's something it is
preventing you from doing.  If what you're trying to accomplish
is to have 'difftool' only show you changes within the current
directory then you can accomplish that today by passing ".",
e.g. "git difftool ."


Implementation details:

difftool is a thin wrapper around 'git diff'.  Specifically,
it is implemented as a $GIT_EXTERNAL_DIFF script which means
that it inherits most of its behavior from 'diff'.
The "chdir to root" behavior actually happens inside of
'git diff'.

Can we can change the behavior? Sure, anything is possible.
The question is *should* we change the behavior?
Even though I highly doubt there are any scripts relying on it,
I don't think we gain much by doing so.  The downside to
changing it is that we lose consistency, which is not so good.
I hope that's a compelling enough argument :-)

I hope the "." thing helps.

Cheers,
-- 
					David
--
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]