gitgit-diffgit-gui

Can I make "git gui" pass, say, "--patience" to "git diff"?


I'm really just looking for a way to configure git gui to generate diffs as if by git diff --patience, but I strongly suspect that any mechanism which might allow me to do this would allow other options to be passed as well, and so I ask the more general question in the interest of serving posterity better:

Is there a way to set some git diff options that git gui should use in generating the diffs it shows?


Solution

  • As far as I can tell, there doesn't seem to be a general way to do this. There is a particular config option for setting the number of context lines to show (gui.diffcontext) but no generic config option to add other arguments to the invocation of git diff-index.

    However, git-gui is written in Tcl, so it's easy to add this option. If you find diff.tcl on your system* you can just add the line lappend cmd --patience after the line lappend cmd -p.

    * It might be /usr/share/git-gui/lib/diff.tcl if you're using a packaged version...


    Thanks to Pat Thoyts, the maintainer of git gui, for pointing out in the comments below that a gui.diffopts option has been now been added to git gui so that you can customize the options used for diffs. (That change was introduced in this commit but as far as I know is not in a released version of git yet.)