mirror of
https://forgejo.stefka.eu/jiriks74/create-pull-request.git
synced 2025-01-18 16:01:06 +01:00
fix: support submodules when commit signing (#3354)
* fix: support submodules when commit signing * create correct tree object for submodule * update log messages
This commit is contained in:
parent
7a8aeac749
commit
2f38cd26bf
5 changed files with 116 additions and 75 deletions
|
@ -250,11 +250,15 @@ describe('create-or-update-branch tests', () => {
|
|||
expect(branchCommits.length).toEqual(1)
|
||||
expect(branchCommits[0].subject).toEqual('Test changes')
|
||||
expect(branchCommits[0].changes.length).toEqual(3)
|
||||
expect(branchCommits[0].changes).toEqual([
|
||||
{mode: '100755', path: UNTRACKED_EXE_FILE, status: 'A'},
|
||||
{mode: '100644', path: TRACKED_FILE, status: 'M'},
|
||||
{mode: '100644', path: UNTRACKED_FILE, status: 'A'}
|
||||
])
|
||||
expect(branchCommits[0].changes[0].mode).toEqual('100755')
|
||||
expect(branchCommits[0].changes[0].path).toEqual(UNTRACKED_EXE_FILE)
|
||||
expect(branchCommits[0].changes[0].status).toEqual('A')
|
||||
expect(branchCommits[0].changes[1].mode).toEqual('100644')
|
||||
expect(branchCommits[0].changes[1].path).toEqual(TRACKED_FILE)
|
||||
expect(branchCommits[0].changes[1].status).toEqual('M')
|
||||
expect(branchCommits[0].changes[2].mode).toEqual('100644')
|
||||
expect(branchCommits[0].changes[2].path).toEqual(UNTRACKED_FILE)
|
||||
expect(branchCommits[0].changes[2].status).toEqual('A')
|
||||
})
|
||||
|
||||
it('tests buildBranchCommits with addition and deletion', async () => {
|
||||
|
@ -272,11 +276,15 @@ describe('create-or-update-branch tests', () => {
|
|||
expect(branchCommits.length).toEqual(1)
|
||||
expect(branchCommits[0].subject).toEqual('Test changes')
|
||||
expect(branchCommits[0].changes.length).toEqual(3)
|
||||
expect(branchCommits[0].changes).toEqual([
|
||||
{mode: '100644', path: TRACKED_FILE, status: 'D'},
|
||||
{mode: '100644', path: UNTRACKED_FILE, status: 'A'},
|
||||
{mode: '100644', path: TRACKED_FILE_NEW_PATH, status: 'A'}
|
||||
])
|
||||
expect(branchCommits[0].changes[0].mode).toEqual('100644')
|
||||
expect(branchCommits[0].changes[0].path).toEqual(TRACKED_FILE)
|
||||
expect(branchCommits[0].changes[0].status).toEqual('D')
|
||||
expect(branchCommits[0].changes[1].mode).toEqual('100644')
|
||||
expect(branchCommits[0].changes[1].path).toEqual(UNTRACKED_FILE)
|
||||
expect(branchCommits[0].changes[1].status).toEqual('A')
|
||||
expect(branchCommits[0].changes[2].mode).toEqual('100644')
|
||||
expect(branchCommits[0].changes[2].path).toEqual(TRACKED_FILE_NEW_PATH)
|
||||
expect(branchCommits[0].changes[2].status).toEqual('A')
|
||||
})
|
||||
|
||||
it('tests buildBranchCommits with multiple commits', async () => {
|
||||
|
@ -294,10 +302,13 @@ describe('create-or-update-branch tests', () => {
|
|||
expect(branchCommits[i].subject).toEqual(`Test changes ${i}`)
|
||||
expect(branchCommits[i].changes.length).toEqual(2)
|
||||
const untrackedFileStatus = i == 0 ? 'A' : 'M'
|
||||
expect(branchCommits[i].changes).toEqual([
|
||||
{mode: '100644', path: TRACKED_FILE, status: 'M'},
|
||||
{mode: '100644', path: UNTRACKED_FILE, status: untrackedFileStatus}
|
||||
])
|
||||
|
||||
expect(branchCommits[i].changes[0].mode).toEqual('100644')
|
||||
expect(branchCommits[i].changes[0].path).toEqual(TRACKED_FILE)
|
||||
expect(branchCommits[i].changes[0].status).toEqual('M')
|
||||
expect(branchCommits[i].changes[1].mode).toEqual('100644')
|
||||
expect(branchCommits[i].changes[1].path).toEqual(UNTRACKED_FILE)
|
||||
expect(branchCommits[i].changes[1].status).toEqual(untrackedFileStatus)
|
||||
}
|
||||
})
|
||||
|
||||
|
|
|
@ -18,9 +18,9 @@ describe('git-command-manager integration tests', () => {
|
|||
|
||||
expect(initialCommit.subject).toEqual('initial commit')
|
||||
expect(initialCommit.signed).toBeFalsy()
|
||||
expect(initialCommit.changes).toEqual([
|
||||
{mode: '100644', status: 'A', path: 'README_TEMP.md'}
|
||||
])
|
||||
expect(initialCommit.changes[0].mode).toEqual('100644')
|
||||
expect(initialCommit.changes[0].status).toEqual('A')
|
||||
expect(initialCommit.changes[0].path).toEqual('README_TEMP.md')
|
||||
|
||||
expect(emptyCommit.subject).toEqual('empty commit for tests')
|
||||
expect(emptyCommit.tree).toEqual(initialCommit.tree) // empty commits have no tree and reference the parent's
|
||||
|
@ -31,16 +31,18 @@ describe('git-command-manager integration tests', () => {
|
|||
expect(modifiedCommit.subject).toEqual('add sparkles')
|
||||
expect(modifiedCommit.parents[0]).toEqual(emptyCommit.sha)
|
||||
expect(modifiedCommit.signed).toBeFalsy()
|
||||
expect(modifiedCommit.changes).toEqual([
|
||||
{mode: '100644', status: 'M', path: 'README_TEMP.md'}
|
||||
])
|
||||
expect(modifiedCommit.changes[0].mode).toEqual('100644')
|
||||
expect(modifiedCommit.changes[0].status).toEqual('M')
|
||||
expect(modifiedCommit.changes[0].path).toEqual('README_TEMP.md')
|
||||
|
||||
expect(headCommit.subject).toEqual('rename readme')
|
||||
expect(headCommit.parents[0]).toEqual(modifiedCommit.sha)
|
||||
expect(headCommit.signed).toBeFalsy()
|
||||
expect(headCommit.changes).toEqual([
|
||||
{mode: '100644', status: 'A', path: 'README.md'},
|
||||
{mode: '100644', status: 'D', path: 'README_TEMP.md'}
|
||||
])
|
||||
expect(headCommit.changes[0].mode).toEqual('100644')
|
||||
expect(headCommit.changes[0].status).toEqual('A')
|
||||
expect(headCommit.changes[0].path).toEqual('README.md')
|
||||
expect(headCommit.changes[1].mode).toEqual('100644')
|
||||
expect(headCommit.changes[1].status).toEqual('D')
|
||||
expect(headCommit.changes[1].path).toEqual('README_TEMP.md')
|
||||
})
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue