Thread (1 message) 1 message, 1 author, 2016-06-15

Re: git gui diff widget (was Re: [msysGit] Re: [cheetah] Questions about NOTES)

From: Shawn O. Pearce <hidden>
Date: 2016-06-15 22:44:09

Steffen Prohaska [off-list ref] wrote:
On Jan 30, 2008, at 5:03 AM, Shawn O. Pearce wrote:
quoted
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.
I hear this a lot from a co-worker.  He really wants a side-by-side
diff tool in git, as he doesn't like reading patches.  Me, I've
never been able to read a side-by-side diff tool, but I can grok
a unified diff quite easily.  To each his own, and git should help
users as much as it can.
 
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?
Yea, that makes sense.  But we may want to go the other way,
that is reuse gitk's patch viewer.  Or something.  The two tools
(git-gui and gitk) grew their diff viewers independently, though
I have to say that git-gui's was inspired by gitk's, and the work
that Paul did on gitool waaaaay back when.

Right now though I doubt there's a single line of code in common
between them.  Hmm, I think they both use the Tk "text" widget.
And a blue-ish color for hunk headers.  :)


Adding a feature to git-gui to launch an external diff of that
file against the index or HEAD shouldn't be too difficult, and I
think is what would be most natural for the current UI.  The ugly
part is pulling out the HEAD/index version into a temporary file
and passing a nice -L (or something like) option to the user's diff
viewer so they don't see the nasty temporary file name, but instead
see a string that matches what git-gui is showing them.  And that
option is going to differ for like every tool out there.  :-\

-- 
Shawn.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help