christkv/node-git

Commit message unavailable

StewartAtkins opened this issue · 3 comments

The vast majority of commit messages appear to have an empty string as commit message. This appears to be due to lib/commit.js:11-13 forcing _message to have a value and thus preventing the lazy load from obtaining the actual message.

Hi @StewartAtkins, thanks for noticing this problem! Could you please suggest a fix in a pull request? I'd be happy to review it.

All of my one-line commit messages (beyond the subject line) appear empty, and multiline messages are missing the last line.

It seems to be due to this line - has that 'last line is empty' assumption ever been valid?

// Remove the last line which will be empty
for(var i = 0; i < (lines.length > 1 ? lines.length - 1 : lines.length); i++) {
  output = output + '    ' + lines[i] + '\n';
}

https://github.com/christkv/node-git/blob/master/lib/git/internal/git_commit.js#L70

Nice catch, the assumption is probably invalid today, but thanks for staying on the safe side in your commit!