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, 17:21 UTC
Message-ID
<7vr4xe27sq.fsf@alter.siamese.dyndns.org>
In-Reply-To
<87haybco1j.fsf@thomas.inf.ethz.ch>
Thomas Rast <trast@inf.ethz.ch> writes:
> So either there's a lot to be fixed, or fsck needs to catch this.

Your experiment with hash-object aside (that is like saying "I can write garbage with a disk editor, and now OS cannot read from that directory"), if somebody manages to create a commit without any body, it is clear that the user wanted to record no body. I think all code that tries to run strstr("\n\n") and increment the resulting pointer by two to find the beginning of the body should behave as if it found one and the result pointed at a NUL. Rejecting with fsck does not help anybody, as it happens after the fact.

Previous: Thomas RastNext: Jeff King
Message 5 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.