* Allow editing of a revert-message
@ 2005-11-23 17:57 Linus Torvalds
2005-11-23 19:29 ` Junio C Hamano
0 siblings, 1 reply; 3+ messages in thread
From: Linus Torvalds @ 2005-11-23 17:57 UTC (permalink / raw)
To: Junio C Hamano, Git Mailing List
I think all commit operations should allow editing of the message (ie we
should do this for merges too), but that's _particularly_ true of doing a
"git revert".
We should always explain why we needed to revert something.
This patch adds a "-e" or "--edit" flag to "git revert", although I
actually suspect it should be on by default (and we should have a
"--no-edit" flag to disable it, probably together with an automatic
disable if stdin isn't a terminal).
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
---
diff --git a/git-revert.sh b/git-revert.sh
index 4154fe0..05bd854 100755
--- a/git-revert.sh
+++ b/git-revert.sh
@@ -25,7 +25,7 @@ usage () {
esac
}
-no_commit= replay=
+no_commit= replay= edit=
while case "$#" in 0) break ;; esac
do
case "$1" in
@@ -36,6 +36,9 @@ do
-r|--r|--re|--rep|--repl|--repla|--replay)
replay=t
;;
+ -e|--edit)
+ edit=t
+ ;;
-*)
usage
;;
@@ -161,6 +164,7 @@ echo >&2 "Finished one $me."
# If we are revert, or if our cherry-pick results in a hand merge,
# we had better say that the current user is responsible for that.
+[ "$edit" ] && ${EDITOR:-${VISUAL:-vi}} .msg
case "$no_commit" in
'')
git-commit -n -F .msg
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: Allow editing of a revert-message
2005-11-23 17:57 Allow editing of a revert-message Linus Torvalds
@ 2005-11-23 19:29 ` Junio C Hamano
2005-11-23 19:42 ` Linus Torvalds
0 siblings, 1 reply; 3+ messages in thread
From: Junio C Hamano @ 2005-11-23 19:29 UTC (permalink / raw)
To: git
Linus Torvalds <torvalds@osdl.org> writes:
> ..., although I
> actually suspect it should be on by default (and we should have a
> "--no-edit" flag to disable it, probably together with an automatic
> disable if stdin isn't a terminal).
Thanks, and I agree. It is very very unlikely that somebody has
git-revert in her script and relies on git-revert to be
non-interactive, so we might not even need --no-edit.
> +[ "$edit" ] && ${EDITOR:-${VISUAL:-vi}} .msg
> case "$no_commit" in
> '')
> git-commit -n -F .msg
I think we can do
-e)
edit="-e" ;;
..
git-commit -n -F .msg $edit
to lose the ${EDITOR-${VISUAL-vi}} part..
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: Allow editing of a revert-message
2005-11-23 19:29 ` Junio C Hamano
@ 2005-11-23 19:42 ` Linus Torvalds
0 siblings, 0 replies; 3+ messages in thread
From: Linus Torvalds @ 2005-11-23 19:42 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
On Wed, 23 Nov 2005, Junio C Hamano wrote:
>
> I think we can do
>
> -e)
> edit="-e" ;;
> ..
>
> git-commit -n -F .msg $edit
>
> to lose the ${EDITOR-${VISUAL-vi}} part..
You are of course right. That would also fix the total idiocy of my patch
that had you editing the message even if it wasn't used due to a "-n" that
disables commits ;)
Linus
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2005-11-23 19:42 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-11-23 17:57 Allow editing of a revert-message Linus Torvalds
2005-11-23 19:29 ` Junio C Hamano
2005-11-23 19:42 ` Linus Torvalds
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox