On Wed, Feb 03, 2010 at 01:15:35AM -0500, Larry D'Anna wrote: > * Avery Pennarun (apenwarr@xxxxxxxxx) [100202 18:41]: > > You can however add *new* stuff. That's why I suggested adding an > > option. You could even make it a config option so you only have to > > set it once (just like setting your preferred editor). > > Or, he can set his $EDITOR to a script that checks the mtime. Agreed. It could even look like this: -- >8 -- $ cat >vi-must-edit <<'EOF' #!/usr/bin/perl sub mtime { (stat $_[0])[9] } my $old = mtime($ARGV[-1]); system('vi', @ARGV) and die "vi failed"; if (mtime($ARGV[-1]) == $old) { print STDERR "Aborting unmodified message\n"; exit 1; } exit 0 EOF $ chmod +x vi-must-edit $ GIT_EDITOR=$PWD/vi-must-edit; export GIT_EDITOR $ git commit --amend ;# and then quit the editor immediately Aborting unmodified message error: There was a problem with the editor 'vi-must-edit'. Please supply the message using either -m or -F option. -- 8< -- Do note, though, that there is a subtle race condition in using the mtime. If you make a change and save within a second of the editor starting, it will be ignored. To be thorough, you would probably want to check the size and inode, as well. -Peff -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html