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

2 messages, 2 authors, 2016-06-15 · open the first message on its own page

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

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:53:10

Thomas Rast [off-list ref] 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.

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

From: Jeff King <hidden>
Date: 2016-06-15 22:53:10

On Tue, Feb 28, 2012 at 09:21:09AM -0800, Junio C Hamano wrote:
Thomas Rast [off-list ref] writes:
quoted
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"),
Yes, but the difference between "OS cannot read from that directory" and
"OS segfaults" might be worth noticing. :)
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.
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.

-Peff
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help