Page MenuHomePhabricator

Gerrit commit message body wrapped near 80 characters instead 100
Open, LowPublic


An example from

image.png (337×626 px, 31 KB)

In this commit message, the longest line is 84 characters. Which is with in the limits of 100 characters as doumented at

As we can see, the lines are wrapped unnecessary and makes the reading difficult

Expected result:

Commit message body wrapped only at 100 characters or above

Event Timeline

hashar added a subscriber: hashar.

The example at the top of the guide has the longest line at 65 characters. It used to state More details, wrap lines around 76 characters. (diff).

Gerrit uses some CSS magic to find the size of the box:

.commitMessage {
  /* Account for border and padding and rounding errors. */
  max-width: calc(72ch + 2px + 2 * var(--spacing-m) + 0.4px);

#commitMessageEditor {
  min-width: calc(72ch + 2px + 2 * var(--spacing-m) + 0.4px)

It used to be min-width: 72ch;.

607030-commit-message.png (347×677 px, 35 KB)

608014-commit-message.png (350×685 px, 43 KB)

Our commit message validator code (integration/commit-message-validator) enforces 80 characters or less for the first line and accepts up to 100 characters in the body. I guess based on the wiki article.

def check_line(self, lineno):
    line = self._lines[lineno]

    # First line <=80
    if lineno == 0 and len(line) > 80:
        if not RE_REVERT_SUBJECT.match(line):
            yield "First line should be <=80 characters"

    # No line >100 characters (unless it is only a URL)
    elif len(line) > 100 and not RE_URL.match(line):
        yield "Line should be <=100 characters"