From: Steffen Prohaska Date: Wed, 30 Jan 2008 07:00:56 GMT Subject: git gui diff widget (was Re: [msysGit] Re: [cheetah] Questions about NOTES) Message-ID: <75E9DFB9-BE1B-4B60-921D-EE0898DFA9F3@zib.de> In-Reply-To: <20080130040336.GN24004-o8xcbExO1WpAfugRpC6u6w@public.gmane.org> [ I put the git list on CC and chose a new topic. ] On Jan 30, 2008, at 5:03 AM, Shawn O. Pearce wrote: > > Johannes Schindelin wrote: >> On Mon, 28 Jan 2008, Shawn O. Pearce wrote: >>> Johannes Schindelin wrote: >>>> >>>> Another thing (and this concerns you, Shawn): there is this lovely >>>> program called git-gui, and it has most of what we will ever >>>> want to >>>> drive from git-cheetah. Is there any method to call git-gui >>>> such that >>>> it performs a certain command, or is there a chance to get such a >>>> method? >> >> I did not mean to remote control it, just to start it with a default >> action, such as "diff file to HEAD", or "diff directory >> to >> index". > > Oh, like we do for `git gui blame HEAD file` ? :-) > > That isn't too difficult. git-gui currently cannot show a diff of > a directory, it can only diff a single file at a time, but yea, > it wouldn't be hard to add a `git gui diff file` to have it open > up and show the current difference of index<->file or HEAD<->index > for that path. > > Doing a diff against a random other tree-ish, or between two random > tree-ishes would be possible, but a lot more of a challenge. > > The diff viewer in git-gui isn't exactly a reusable widget. > We'd need to refactor that so it could take patch output from any > of the patch generating git commands. Doing such is on my list > of things I'd like to fix in git-gui, but I haven't had time to > do it yet. Hmm, I'm not sure if such a full diff viewer is the most important thing to address. Most users (especially Windows users) already have a favorite graphical diff tool and they expect a mechanism to plug it into a git workflow. A difficulty they face is that in a git workflow they often need to diff between two trees and this case is currently not handled in a sensible way if you want to view the diffs graphically. Well you could set GIT_EXTERNAL_DIFF to a graphical tool. But then git would pop-up a new instance of your graphical tool for every single file and this is certainly not what you expect (I tried it once and immediately stopped this experiment). I think a tool that presents the list of files with differences and can launch an external tool for one of these files would be very helpful. I started to think about a command line version, git-difftool, implementing this idea, but do not yet have code. A GUI version would be preferable for cheetah anyway. Maybe the patch viewer you sketched above could provide a way to launch an external tool for any of the files touched by the patch? If the widget would be reusable maybe it could also be used in gitk? Steffen