@matheusbsbs / matheus-bagliano / commits / b7884981f8
Fork 0

git-revert: make --edit default.

Revert always should explain why, so make --edit the default, unless stdin is not a terminal. If you really don't want to say anything, you can say "git-revert --no-edit $commit", or if you are really sick, you could also say "git-revert $commit </dev/null". But please don't. You can also say "git-cherry-pick --edit $commit". Not editting the commit log message is the default for cherry-pick. Signed-off-by: Junio C Hamano <junkio@cox.net>

Junio C Hamano committed Nov 23, 2005 at 16:56 UTC b7884981f8f2a063f577df12c65e9af8b1a4f1b8
1 file changed +11 -7
git-revert.sh
+11 -7
@@ -7,11 +7,13 @@
7
8 case "$0" in
9 *-revert* )
10 + test -t 0 && edit=-e
11 me=revert ;;
12 *-cherry-pick* )
13 + edit=
14 me=cherry-pick ;;
15 * )
14 - die "What are ou talking about?" ;;
16 + die "What are you talking about?" ;;
17 esac
18
19 usage () {
@@ -25,7 +27,7 @@ usage () {
27 esac
28 }
29
28 -no_commit= replay= edit=
30 +no_commit= replay=
31 while case "$#" in 0) break ;; esac
32 do
33 case "$1" in
@@ -33,12 +35,15 @@ do
35 --no-commi|--no-commit)
36 no_commit=t
37 ;;
38 + -e|--e|--ed|--edi|--edit)
39 + edit=-e
40 + ;;
41 + -n|--n|--no|--no-|--no-e|--no-ed|--no-edi|--no-edit)
42 + edit=
43 + ;;
44 -r|--r|--re|--rep|--repl|--repla|--replay)
45 replay=t
46 ;;
39 - -e|--edit)
40 - edit=t
41 - ;;
47 -*)
48 usage
49 ;;
@@ -164,10 +169,9 @@ echo >&2 "Finished one $me."
169 # If we are revert, or if our cherry-pick results in a hand merge,
170 # we had better say that the current user is responsible for that.
171
167 -[ "$edit" ] && ${EDITOR:-${VISUAL:-vi}} .msg
172 case "$no_commit" in
173 '')
170 - git-commit -n -F .msg
174 + git-commit -n -F .msg $edit
175 rm -f .msg
176 ;;
177 esac