Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jgit-dev] RevCommit.getShortMessage() length

Would it make sense to limit the length of the string returned by RevCommit.getShortMessage()?
(And RevTag.getShortMessage().)

What if someone has a commit message with a first paragraph that is really long? We'd end up
with such really long messages in the history and the reflog and I don't know where else.

For a command-line client it's not really a problem, but for an IDE it may be. At least it
may lead to crazy layouts in the UI and consume more memory than intended, or some UI
components may get into real troubles when they're asked to display extremely long lines.

Yes, clipping the short message length could be done in the UI, but it would have to be done
in several places, which is error-prone. And the reflog at least would still end up with these
long messages. So I think if it's done it should be done in {RevCommit,RevTag}.getShortMessage()
directly.

How about a limit of 500 characters?

(It's not purely hypothetical. There recently was someone who had a commit message with 90M
characters. In the first version of the unit test I wrote for this, I promptly forgot to give
the test commit a proper short first paragraph. I don't like it if tools can break easily when
users do unexpected things.)

--
Thomas

Back to the top