On Wed, Jun 10, 2015 at 03:12:21PM +0200, Bossert, Andre wrote: > Hello, > > i've tested "git difftool" with -t --ext-cmd and other options to see > my diff with external tools, but it always show internal text-diff in > console. The same tests with "git mergetool" working as expected. I've > compared (nanually reviewed) git-mergetool.sh with git-difftool.pl and > see that difftool is mixed / shared implementation with normal "git > diff" command. So during MERGING state there is no possibility to call > external difftool with this command. Any ideas why this was > implemented this way? > > -- > Regards > Andre (anb0s) > eMail: anb0s@xxxxxxxx The "why" behind this behavior is likely, "historical reasons". The behavior you described is an unfortunate side-effect of how it's implemented under the hood. As you discovered, difftool is built upon git-diff's GIT_EXTERNAL_DIFF feature. That feature is not invoked when the index contains multiple stages (i.e. when merging) and the combined diff is printed instead. A logical extension to the GIT_EXTERNAL_DIFF machinery might be something like supporting a GIT_EXTERNAL_MERGE_DIFF variable to handle the 3-way case. We could then plug this edge case by creating a new handler that reuses the mergetool code[1]. Alternatively, we could make "git diff" stricter and teaach it to die() when doing a mergy diff and GIT_EXTERNAL_DIFF is set. That might break existing setups, though, so having a new feature does seem preferable over making it stricter. As you mentioned, using "git mergetool" works. That's because mergetool is the intended tool for that use case. The fact that difftool prints a combined diff when when your worktree is in the middle of a conflicted merge is simply an unpolished edge case. If you've already resolved all of your conflicts, and everything is staged, then "git difftool --staged" will work too. Let me know if you have any questions. If you're interested in implementing the idea described in [1] then I'd be happy to help review and test the code, but for now you can probably just use "git mergetool". 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