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

Bug: commit -p breaks with -m

From
MNMatan Nassau <matan.nassau@gmail.com>
Date
Aug 15, 2013, 04:43 UTC
Message-ID
<6EC98F2F-98FC-439B-BD9C-B1D0DB1F5E10@gmail.com>
With git 1.8.3.3,
 $ seq 5 >data
 $ git add data
 $ git commit -mdata
 $ sed -i '2 d' data
 $ git commit -pmchange
At the prompt, type e to edit the hunk. The editor doesn't start, but git records a commit.
I found that builtin/commit.c sets the GIT_EDITOR env var to ":" when the user specifies the -m option. This was done in 406400ce4f69. Removing these two lines,
 if (!use_editor)
     setenv("GIT_EDITOR", ":", 1);
seems to fix the issue, but I'm not sure this won't break the prepare-commit-msg hook. I'd like to submit a patch: can I get a hint if this change would break commit hooks or anything else I'm not seeing?
Next: Jeff King
Message 1 of 4 in “Bug: commit -p breaks with -m”
  1. Matan NassauAug 15, 2013
  2. Jeff KingAug 15, 2013
  3. Junio C HamanoAug 15, 2013
  4. Jeff KingAug 15, 2013

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.