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

Re: bug/defaults: COMMIT_EDITMSG not reused after a failed commit

From
Konstantin Ryabitsev <konstantin@linuxfoundation.org>
Date
Jul 24, 2024, 16:53 UTC
Message-ID
<20240724-cryptic-private-mustang-3f50aa@meerkat>
In-Reply-To
<xmqq1q3iyceq.fsf@gitster.g>
On Wed, Jul 24, 2024 at 09:37:01AM GMT, Junio C Hamano wrote:
Show 21 quoted lines
> > 1. delete COMMIT_EDITMSG on success
> >
> > 2. reopen COMMIT_EDITMSG on commit if it exists. Maybe logging something like
> >    "Restoring previous in-progress commit message..." might explain what's
> >    happening.
> > 3. if COMMIT_EDITMSG doesn't exist, re-populate from the template before opening
> >    the editor. We could also do this for "parsed-as-empty" commit messages.
> 
> Unconditionally doing this change would be disruptive to workflows
> of existing users.  To them, Git left COMMIT_EDITMSG available even
> after the commit to them almost forever, but suddenly it stops doing
> so.  Like "git cherry-pick|rebase|revert" that got stopped can be
> restarted _with_ some state information with "--continue", offering
> this as an optional feature might be a possibility, but I haven't
> thought things through.
> 
> An obvious and a lot more lightweight first step is to make it clear
> (perhaps in the error message after a failed commit---after all,
> such a failure from "git commit" should be a rare event) where you
> can resurrect the draft commit message from.  That is independent
> and orthogonal to the "let's reuse COMMIT_EDITMSG file" change.

Yes, I would say even doing the following would result in a better experience for users who don't know about .git/COMMIT_EDITMSG:

1. when git-commit fails, save the message as .git/FAILED_COMMIT_MSG
2. output "Commit message saved as .git/FAILED_COMMIT_MSG"
(exact wording/naming up for debate)
-K
Previous: Junio C HamanoNext: Jeff King
Message 3 of 6 in “bug/defaults: COMMIT_EDITMSG not reused after a failed commit”
  1. Robert CoupJul 24, 2024
  2. Junio C HamanoJul 24, 2024
  3. Konstantin RyabitsevJul 24, 2024
  4. Jeff KingJul 24, 2024
  5. Junio C HamanoJul 25, 2024
  6. Robert CoupJul 25, 2024

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.