{"thread":{"id":"31912","subject":"[BUG] (git commit --patch --message $MESSAGE) disallows hunk editing","startedAt":"2012-10-23T05:48:27Z","lastAt":"2014-09-29T23:01:44Z","messageCount":3,"participants":["Max Nanasy","Pierre-Olivier Vares"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"201719","messageId":"CAM998vGieYU+8s1ermDJSfT8Zu8jDRS4WLjypraoB3iOf+qH7g@mail.gmail.com","threadId":"31912","inReplyTo":null,"subject":"[BUG] (git commit --patch --message $MESSAGE) disallows hunk editing","fromName":"Max Nanasy","fromEmail":"max.nanasy@gmail.com","sentAt":"2012-10-23T05:48:27Z","receivedAt":"2012-10-23T05:48:27Z","isPatch":false,"sender":{"key":"max.nanasy@gmail.com","avatar":"https://avatars.githubusercontent.com/u/628032?v=4"},"body":"Tested against v1.7.12.4\n\nSteps to reproduce:\n\tA. cd $DIRTY_WORKING_COPY\n\tB. git commit --patch --message $MESSAGE\n\tC. Stage this hunk? e\nExpected behavior:\n\tAfter step C, the hunk opens in the user's editor\nActual behavior:\n\tAfter step C, the hunk is selected unedited (as if the user had entered \"y\")\n\nAFAICT, this occurs because of the following code in\nbuiltin/commit.c:parse_and_validate_options:\n\tif (... || message.len || ...)\n\t\tuse_editor = 0;\n\t...\n\tif (!use_editor)\n\t\tsetenv(\"GIT_EDITOR\", \":\", 1);\nBecause --message is specified, GIT_EDITOR is set to \":\", which\nprevents the user from editing hunks, although the intent is most\nlikely to just prevent the user from editing the commit message.\n"},{"id":"235443","messageId":"loom.20140226T160605-845@post.gmane.org","threadId":"31912","inReplyTo":"CAM998vGieYU+8s1ermDJSfT8Zu8jDRS4WLjypraoB3iOf+qH7g@mail.gmail.com","subject":"Re: [BUG] (git commit --patch --message $MESSAGE) disallows hunk editing","fromName":"Pierre-Olivier Vares","fromEmail":"pov@fingerprint.fr","sentAt":"2014-02-26T15:07:31Z","receivedAt":"2014-02-26T15:07:31Z","isPatch":false,"sender":{"key":"pov@fingerprint.fr","avatar":null},"body":"Max Nanasy <max.nanasy <at> gmail.com> writes:\n\n> Tested against v1.7.12.4\n\nConfirmed in 1.8.5.2\n"},{"id":"250009","messageId":"loom.20140930T005553-169@post.gmane.org","threadId":"31912","inReplyTo":"CAM998vGieYU+8s1ermDJSfT8Zu8jDRS4WLjypraoB3iOf+qH7g@mail.gmail.com","subject":"Re: [BUG] (git commit --patch --message $MESSAGE) disallows hunk editing","fromName":"Max Nanasy","fromEmail":"max.nanasy@gmail.com","sentAt":"2014-09-29T23:01:44Z","receivedAt":"2014-09-29T23:01:44Z","isPatch":false,"sender":{"key":"max.nanasy@gmail.com","avatar":"https://avatars.githubusercontent.com/u/628032?v=4"},"body":"Max Nanasy <max.nanasy <at> gmail.com> writes:\n\n> \n> Tested against v1.7.12.4\n> \n> Steps to reproduce:\n> \tA. cd $DIRTY_WORKING_COPY\n> \tB. git commit --patch --message $MESSAGE\n> \tC. Stage this hunk? e\n> Expected behavior:\n> \tAfter step C, the hunk opens in the user's editor\n> Actual behavior:\n> \tAfter step C, the hunk is selected unedited (as if the user had entered \"y\")\n> \n> AFAICT, this occurs because of the following code in\n> builtin/commit.c:parse_and_validate_options:\n> \tif (... || message.len || ...)\n> \t\tuse_editor = 0;\n> \t...\n> \tif (!use_editor)\n> \t\tsetenv(\"GIT_EDITOR\", \":\", 1);\n> Because --message is specified, GIT_EDITOR is set to \":\", which\n> prevents the user from editing hunks, although the intent is most\n> likely to just prevent the user from editing the commit message.\n> \n\nIt appears that this was fixed in version 2.0.  The changelog entry says:\n\n * When it is not necessary to edit a commit log message (e.g. \"git\n   commit -m\" is given a message without specifying \"-e\"), we used to\n   disable the spawning of the editor by overriding GIT_EDITOR, but\n   this means all the uses of the editor, other than to edit the\n   commit log message, are also affected.\n   (merge b549be0 bp/commit-p-editor later to maint).\n"}]}