MCPcopy
hub / github.com/peter-evans/create-pull-request / getCommit

Method getCommit

src/git-command-manager.ts:164–209  ·  view source on GitHub ↗
(ref: string)

Source from the content-addressed store, hash-verified

162 }
163
164 async getCommit(ref: string): Promise<Commit> {
165 const endOfBody = '###EOB###'
166 const output = await this.exec(
167 [
168 '-c',
169 'core.quotePath=false',
170 'show',
171 '--raw',
172 '--cc',
173 '--no-renames',
174 '--no-abbrev',
175 `--format=%H%n%T%n%P%n%G?%n%s%n%b%n${endOfBody}`,
176 ref
177 ],
178 {suppressGitCmdOutput: true}
179 )
180 const lines = output.stdout.split('\n')
181 const endOfBodyIndex = lines.lastIndexOf(endOfBody)
182 const detailLines = lines.slice(0, endOfBodyIndex)
183
184 const unparsedChanges: string[] = []
185 return <Commit>{
186 sha: detailLines[0],
187 tree: detailLines[1],
188 parents: detailLines[2].split(' '),
189 signed: detailLines[3] !== 'N',
190 subject: detailLines[4],
191 body: detailLines.slice(5, endOfBodyIndex).join('\n'),
192 changes: lines.slice(endOfBodyIndex + 2, -1).map(line => {
193 const change = line.match(
194 /^:(\d{6}) (\d{6}) \w{40} (\w{40}) ([AMD])\s+(.*)$/
195 )
196 if (change) {
197 return {
198 mode: change[4] === 'D' ? change[1] : change[2],
199 dstSha: change[3],
200 status: change[4],
201 path: change[5]
202 }
203 } else {
204 unparsedChanges.push(line)
205 }
206 }),
207 unparsedChanges: unparsedChanges
208 }
209 }
210
211 async getConfigValue(configKey: string, configValue = '.'): Promise<string> {
212 const output = await this.exec([

Callers

nothing calls this directly

Calls 2

execMethod · 0.95
pushMethod · 0.80

Tested by

no test coverage detected