Re: [PATCH] Added giteditor script to show diff while editing commit message.
- From
Ted Pavlic <ted@tedpavlic.com>
- Date
- Jan 22, 2009, 01:46 UTC
- Message-ID
- <4977CFDF.4040200@tedpavlic.com>
- In-Reply-To
- <alpine.DEB.1.00.0901212343100.3586@pacific.mpi-cbg.de>
Show 7 quoted lines
>> 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.
Show 6 quoted lines
>>> 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<Down>) and I find myself scrolling around in the diff. I hit ^W^W again (or ^W<Up>) 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. <?>
Show 5 quoted lines
>> 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.
Show 5 quoted lines
> - 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 <ted@tedpavlic.com>
Please visit my ALS association page:
http://web.alsa.org/goto/tedpavlic
My family appreciates your support in the fight to defeat ALS.