{"thread":{"id":"2662","subject":"Allow editing of a revert-message","startedAt":"2005-11-23T17:57:54Z","lastAt":"2005-11-23T19:42:01Z","messageCount":3,"participants":["Linus Torvalds","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"12631","messageId":"Pine.LNX.4.64.0511230954440.13959@g5.osdl.org","threadId":"2662","inReplyTo":null,"subject":"Allow editing of a revert-message","fromName":"Linus Torvalds","fromEmail":"torvalds@osdl.org","sentAt":"2005-11-23T17:57:54Z","receivedAt":"2005-11-23T17:57:54Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\nI think all commit operations should allow editing of the message (ie we \nshould do this for merges too), but that's _particularly_ true of doing a \n\"git revert\".\n\nWe should always explain why we needed to revert something.\n\nThis patch adds a \"-e\" or \"--edit\" flag to \"git revert\", although I \nactually suspect it should be on by default (and we should have a \n\"--no-edit\" flag to disable it, probably together with an automatic \ndisable if stdin isn't a terminal).\n\nSigned-off-by: Linus Torvalds <torvalds@osdl.org>\n---\ndiff --git a/git-revert.sh b/git-revert.sh\nindex 4154fe0..05bd854 100755\n--- a/git-revert.sh\n+++ b/git-revert.sh\n@@ -25,7 +25,7 @@ usage () {\n \tesac\n }\n \n-no_commit= replay=\n+no_commit= replay= edit=\n while case \"$#\" in 0) break ;; esac\n do\n \tcase \"$1\" in\n@@ -36,6 +36,9 @@ do\n \t-r|--r|--re|--rep|--repl|--repla|--replay)\n \t\treplay=t\n \t\t;;\n+\t-e|--edit)\n+\t\tedit=t\n+\t\t;;\n \t-*)\n \t\tusage\n \t\t;;\n@@ -161,6 +164,7 @@ echo >&2 \"Finished one $me.\"\n # If we are revert, or if our cherry-pick results in a hand merge,\n # we had better say that the current user is responsible for that.\n \n+[ \"$edit\" ] && ${EDITOR:-${VISUAL:-vi}} .msg\n case \"$no_commit\" in\n '')\n \tgit-commit -n -F .msg\n"},{"id":"12633","messageId":"7v7jaz5fj7.fsf@assigned-by-dhcp.cox.net","threadId":"2662","inReplyTo":"Pine.LNX.4.64.0511230954440.13959@g5.osdl.org","subject":"Re: Allow editing of a revert-message","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-11-23T19:29:32Z","receivedAt":"2005-11-23T19:29:32Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Linus Torvalds <torvalds@osdl.org> writes:\n\n> ..., although I \n> actually suspect it should be on by default (and we should have a \n> \"--no-edit\" flag to disable it, probably together with an automatic \n> disable if stdin isn't a terminal).\n\nThanks, and I agree.  It is very very unlikely that somebody has\ngit-revert in her script and relies on git-revert to be\nnon-interactive, so we might not even need --no-edit.\n\n> +[ \"$edit\" ] && ${EDITOR:-${VISUAL:-vi}} .msg\n>  case \"$no_commit\" in\n>  '')\n>  \tgit-commit -n -F .msg\n\nI think we can do\n\n\t-e)\n\t\tedit=\"-e\" ;;\n        ..\n\n\tgit-commit -n -F .msg $edit\n\nto lose the ${EDITOR-${VISUAL-vi}} part..\n"},{"id":"12634","messageId":"Pine.LNX.4.64.0511231141030.13959@g5.osdl.org","threadId":"2662","inReplyTo":"7v7jaz5fj7.fsf@assigned-by-dhcp.cox.net","subject":"Re: Allow editing of a revert-message","fromName":"Linus Torvalds","fromEmail":"torvalds@osdl.org","sentAt":"2005-11-23T19:42:01Z","receivedAt":"2005-11-23T19:42:01Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Wed, 23 Nov 2005, Junio C Hamano wrote:\n>\n> I think we can do\n> \n> \t-e)\n> \t\tedit=\"-e\" ;;\n>         ..\n> \n> \tgit-commit -n -F .msg $edit\n> \n> to lose the ${EDITOR-${VISUAL-vi}} part..\n\nYou are of course right. That would also fix the total idiocy of my patch \nthat had you editing the message even if it wasn't used due to a \"-n\" that \ndisables commits ;)\n\n\t\tLinus\n"}]}