git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[BUG] (git commit --patch --message $MESSAGE) disallows hunk editing

From
Max Nanasy <max.nanasy@gmail.com>
Date
Oct 23, 2012, 05:48 UTC
Message-ID
<CAM998vGieYU+8s1ermDJSfT8Zu8jDRS4WLjypraoB3iOf+qH7g@mail.gmail.com>
Tested against v1.7.12.4
Steps to reproduce:
	A. cd $DIRTY_WORKING_COPY
	B. git commit --patch --message $MESSAGE
	C. Stage this hunk? e
Expected behavior:
	After step C, the hunk opens in the user's editor
Actual behavior:
	After step C, the hunk is selected unedited (as if the user had entered "y")
AFAICT, this occurs because of the following code in
builtin/commit.c:parse_and_validate_options:
	if (... || message.len || ...)
		use_editor = 0;
	...
	if (!use_editor)
		setenv("GIT_EDITOR", ":", 1);
Because --message is specified, GIT_EDITOR is set to ":", which
prevents the user from editing hunks, although the intent is most
likely to just prevent the user from editing the commit message.
Next: Pierre-Olivier Vares
Message 1 of 3 in “[BUG] (git commit --patch --message $MESSAGE) disallows hunk editing”
  1. Max NanasyOct 23, 2012
  2. Pierre-Olivier VaresFeb 26, 2014
  3. Max NanasySep 29, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.