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
Jeff King [off-list ref] writes:
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...