From: Ted Pavlic Date: Thu, 22 Jan 2009 01:46:07 GMT Subject: Re: [PATCH] Added giteditor script to show diff while editing commit message. Message-ID: <4977CFDF.4040200@tedpavlic.com> In-Reply-To: >> Thanks for your comments. I've responded below. I just want to >> top-respond to your comment that the fundamental problem is that the >> diff is in a separate file. In fact, this is the point of the script. I >> want to be able to scroll through the diff output independent of the >> commit message. > Once again, note that e.g. vi will not cope with the way you try to > achieve that. It does for me just fine. In vi, I hit ^W^W and move from commit message to diff and back. What's the problem with that? In gvim I'm able to click back and forth. I have been using this method for a long time with hg, and now I've been using it with git. This isn't theory --- it's been working in practice for me. Am I missing something? > Why not .git/? That would be the _natural_ place to put it. Why doesn't stg do that? I figured stg would be a well-established program to pattern behavior off of. I'll rev-parse the git dir and place the file there. >>> vi users will hate you, as you do not give them a chance to edit the >>> message after having seen the diff. >> I don't see what you mean. I am a vi user (exclusively), and this script >> works very well for me. > I cannot go back to the commit message when I said ":n" to get to the > diff. vi opens for me and I see two windows. The top window shows the commit message and the bottom window shows the diff. I hit ^W^W (or ^W) and I find myself scrolling around in the diff. I hit ^W^W again (or ^W) and I find myself scrolling around in the commit. Similarly, gvim lets me mouse around both --- clicking from window to window. If you must use ":n", I don't know why you can't use ":prev" to go back. >> Is there no value in having the diff in a separate file? > In my case, no, for 2 reasons: > - I can always open a new shell (in ssh connections, I use screen) to get > the diff, and even better: I can restrict it to certain files, and I can > use the nice bookmarks "less" provides; dunno if vi would have them. vi does. > - My preference is definitely to look at the diff before committing, to be > certain that I did not fsck up. And nothing would annoy me more than to > be in the middle of editing a commit message while I am looking at the > diff and telling myself "that is a stupid mistake, let's fix it" knowing > that the commit will not pick up the fix. When giving a detailed message bulletting out everything that goes into a commit, sometimes it's nice to have a very nearby look at the diff. > So seeing the diff while composing the commit message is definitely too > late for me. Nevertheless, the secondary purpose of the contributed script is to show how GIT_EDITOR can be used to wrap around other editors. (that's the purpose of Mercurial's distributed "hgeditor" script as well) --Ted -- Ted Pavlic Please visit my ALS association page: http://web.alsa.org/goto/tedpavlic My family appreciates your support in the fight to defeat ALS.