ariatemplates/git-release-notes

Crash when revisions are the same

Closed this issue · 1 comments

I am trying to use this tool within Jenkins to generate a changelog between the last successful build and the git HEAD, so I need to be able to programmatically specify the first revision and always use HEAD as the second revision. Unfortunately, if the two revisions happen to be the same, a crash occurs and produces the following stack trace:

$ git-release-notes HEAD..HEAD markdown

/usr/lib/node_modules/git-release-notes/lib/git.js:43
            workingCommit.messageLines.push(line.message);
                         ^
TypeError: Cannot read property 'messageLines' of undefined
    at /usr/lib/node_modules/git-release-notes/lib/git.js:43:17
    at Array.forEach (native)
    at processCommits (/usr/lib/node_modules/git-release-notes/lib/git.js:35:9)
    at ChildProcess.<anonymous> (/usr/lib/node_modules/git-release-notes/lib/git.js:17:18)
    at ChildProcess.emit (events.js:98:17)
    at Process.ChildProcess._handle.onexit (child_process.js:810:12)

As for the expected behavior, I would love for it to still produce output (i.e. in the case of the html template, still generate the base document but with no content). However, I would also be okay with empty output, as long as it doesn't crash.

My workaround at the moment is to use git rev-parse HEAD to check if the hash is the same before running this tool.