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

Re: [PATCH] commit: allow {--amend|-c foo} when {HEAD|foo} has empty message

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 28, 2012, 21:12 UTC
Message-ID
<7vpqcyy84u.fsf@alter.siamese.dyndns.org>
In-Reply-To
<20120228195931.GE11260@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 6 quoted lines
> Yeah, I agree that treating it like an empty body is reasonable
> (possibly with a warning). But given that nobody has actually seen this
> in the wild, maybe it is simpler to mark it with fsck, and to just die()
> when we see it. That would hopefully alert the author of the broken tool
> early, before the tools is made public. If it turns out that such
> commits do end up in the wild, then we can relax the behavior then.

Yeah, it is not like we would want to encourage a commit with empty body, be it preceded with "\n\n" or just a "\n", in the first place.

We would need to locate all the places that expect that strstr("\n\n") will find something, and add die("commit made with a broken git") at these places anyway, in addition to the change to fsck. Given that, I suspect that the extra amount of the work needed to tweak the code to tolerate such a commit and keep going might not be so big, and going that route would avoid punishing the users of broken versions of git (or broken imitations of git, for that matter), so...

Previous: Jeff KingNext: Thomas Rast
Message 7 of 13 in “commit: allow {--amend|-c foo} when {HEAD|foo} has empty message”
  1. commit: allow {--amend|-c foo} when {HEAD|foo} has empty messageThomas Rast, Feb 28, 2012
  2. Jeff KingFeb 28, 2012
  3. Jeff KingFeb 28, 2012
  4. Thomas RastFeb 28, 2012
  5. Junio C HamanoFeb 28, 2012
  6. Jeff KingFeb 28, 2012
  7. Junio C HamanoFeb 28, 2012
  8. commit: allow {--amend|-c foo} when {HEAD|foo} has empty messageThomas Rast, Feb 28, 2012
  9. pretty: detect missing \n\n in commit messageThomas Rast, Feb 28, 2012
  10. Nguyen Thai Ngoc DuyFeb 28, 2012
  11. Junio C HamanoFeb 28, 2012
  12. parse_commit: refuse to load commit without \n\n separatorThomas Rast, Feb 28, 2012
  13. Junio C HamanoFeb 28, 2012

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.