()
| 58 | } |
| 59 | |
| 60 | parseHeaders() { |
| 61 | const headers = GitCommit.justHeaders(this._commit).split('\n') |
| 62 | const hs = [] |
| 63 | for (const h of headers) { |
| 64 | if (h[0] === ' ') { |
| 65 | // combine with previous header (without space indent) |
| 66 | hs[hs.length - 1] += '\n' + h.slice(1) |
| 67 | } else { |
| 68 | hs.push(h) |
| 69 | } |
| 70 | } |
| 71 | const obj = { |
| 72 | parent: [], |
| 73 | } |
| 74 | for (const h of hs) { |
| 75 | const key = h.slice(0, h.indexOf(' ')) |
| 76 | const value = h.slice(h.indexOf(' ') + 1) |
| 77 | if (Array.isArray(obj[key])) { |
| 78 | obj[key].push(value) |
| 79 | } else { |
| 80 | obj[key] = value |
| 81 | } |
| 82 | } |
| 83 | if (obj.author) { |
| 84 | obj.author = parseAuthor(obj.author) |
| 85 | } |
| 86 | if (obj.committer) { |
| 87 | obj.committer = parseAuthor(obj.committer) |
| 88 | } |
| 89 | return obj |
| 90 | } |
| 91 | |
| 92 | static renderHeaders(obj) { |
| 93 | let headers = '' |
no test coverage detected