MCPcopy Create free account
hub / github.com/isomorphic-git/isomorphic-git / renderHeaders

Method renderHeaders

src/models/GitCommit.js:92–115  ·  view source on GitHub ↗
(obj)

Source from the content-addressed store, hash-verified

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)

Callers 1

renderMethod · 0.80

Calls 2

formatAuthorFunction · 0.90
indentFunction · 0.90

Tested by

no test coverage detected