(obj)
| 90 | } |
| 91 | |
| 92 | static renderHeaders(obj) { |
| 93 | let headers = '' |
| 94 | if (obj.tree) { |
| 95 | headers += `tree ${obj.tree}\n` |
| 96 | } else { |
| 97 | headers += `tree 4b825dc642cb6eb9a060e54bf8d69288fbee4904\n` // the null tree |
| 98 | } |
| 99 | if (obj.parent) { |
| 100 | if (obj.parent.length === undefined) { |
| 101 | throw new InternalError(`commit 'parent' property should be an array`) |
| 102 | } |
| 103 | for (const p of obj.parent) { |
| 104 | headers += `parent ${p}\n` |
| 105 | } |
| 106 | } |
| 107 | const author = obj.author |
| 108 | headers += `author ${formatAuthor(author)}\n` |
| 109 | const committer = obj.committer || obj.author |
| 110 | headers += `committer ${formatAuthor(committer)}\n` |
| 111 | if (obj.gpgsig) { |
| 112 | headers += 'gpgsig' + indent(obj.gpgsig) |
| 113 | } |
| 114 | return headers |
| 115 | } |
| 116 | |
| 117 | static render(obj) { |
| 118 | return GitCommit.renderHeaders(obj) + '\n' + normalizeNewlines(obj.message) |
no test coverage detected