mirror of
https://forgejo.stefka.eu/jiriks74/create-pull-request.git
synced 2025-01-18 16:01:06 +01:00
parse empty commits
This commit is contained in:
parent
a3546365cd
commit
42beb85339
5 changed files with 91 additions and 46 deletions
|
@ -61,6 +61,9 @@ export async function buildBranchCommits(
|
|||
for (const sha of shas) {
|
||||
const commit = await git.getCommit(sha)
|
||||
commits.push(commit)
|
||||
for (const unparsedChange of commit.unparsedChanges) {
|
||||
core.warning(`Skipping unexpected diff entry: ${unparsedChange}`)
|
||||
}
|
||||
}
|
||||
return commits
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@ export type Commit = {
|
|||
status: 'A' | 'M' | 'D'
|
||||
path: string
|
||||
}[]
|
||||
unparsedChanges: string[]
|
||||
}
|
||||
|
||||
export class GitCommandManager {
|
||||
|
@ -158,7 +159,6 @@ export class GitCommandManager {
|
|||
'show',
|
||||
'--raw',
|
||||
'--cc',
|
||||
'--diff-filter=AMD',
|
||||
`--format=%H%n%T%n%P%n%G?%n%s%n%b%n${endOfBody}`,
|
||||
ref
|
||||
])
|
||||
|
@ -166,6 +166,7 @@ export class GitCommandManager {
|
|||
const endOfBodyIndex = lines.lastIndexOf(endOfBody)
|
||||
const detailLines = lines.slice(0, endOfBodyIndex)
|
||||
|
||||
const unparsedChanges: string[] = []
|
||||
return <Commit>{
|
||||
sha: detailLines[0],
|
||||
tree: detailLines[1],
|
||||
|
@ -184,9 +185,10 @@ export class GitCommandManager {
|
|||
path: change[4]
|
||||
}
|
||||
} else {
|
||||
throw new Error(`Unexpected line format: ${line}`)
|
||||
unparsedChanges.push(line)
|
||||
}
|
||||
})
|
||||
}),
|
||||
unparsedChanges: unparsedChanges
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue