Skip to content

Commit f832f22

Browse files
committed
fix: use --no-verify in push and merge for local
1 parent 18a22cc commit f832f22

3 files changed

Lines changed: 24 additions & 12 deletions

File tree

src/server/git/controller.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ export const syncReposHandler = async ({
127127
)
128128

129129
// Push this back to the source branch to retrigger the sync
130-
await git.push(['--force'])
130+
await git.push(['--no-verify', '--force'])
131131

132132
// Return to end function call
133133
return {
@@ -145,12 +145,12 @@ export const syncReposHandler = async ({
145145
gitApiLogger.debug('Checked out branch', input.destination.branch)
146146

147147
// Fast Forward merge the source branch on top of the destination branch
148-
await git.merge(['--ff-only', input.source.branch]) // shouldn't fail because of check above, but nothing done to handle a failure
148+
await git.merge(['--no-verify', '--ff-only', input.source.branch]) // shouldn't fail because of check above, but nothing done to handle a failure
149149
gitApiLogger.debug(
150150
`Merged source branch: ${input.source.branch} into destination branch: ${input.destination.branch} using fast forward`,
151151
)
152152

153-
await git.push(['--force'])
153+
await git.push(['--no-verify', '--force'])
154154

155155
gitApiLogger.debug(
156156
`Pushed to ${input.destination.org}/${input.destination.repo}/${input.destination.branch}`,

src/server/repos/controller.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,11 +147,11 @@ export const createMirrorHandler = async ({
147147
newRepo.data.name,
148148
)
149149
await git.addRemote('upstream', upstreamRemote)
150-
await git.push('upstream', defaultBranch)
150+
await git.push(['--no-verify', 'upstream', defaultBranch])
151151

152152
// Create a new branch on both
153153
await git.checkoutBranch(input.newBranchName, defaultBranch)
154-
await git.push('origin', input.newBranchName)
154+
await git.push(['--no-verify', 'origin', input.newBranchName])
155155

156156
reposApiLogger.info('Mirror created', {
157157
org: newRepo.data.owner.login,

test/server/git/controller.test.ts

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -187,9 +187,13 @@ describe('Git controller', () => {
187187
'destination/destinationBranch',
188188
)
189189
expect(gitMock.merge).toHaveBeenCalledTimes(1)
190-
expect(gitMock.merge).toHaveBeenCalledWith(['--ff-only', 'sourceBranch'])
190+
expect(gitMock.merge).toHaveBeenCalledWith([
191+
'--no-verify',
192+
'--ff-only',
193+
'sourceBranch',
194+
])
191195
expect(gitMock.push).toHaveBeenCalledTimes(1)
192-
expect(gitMock.push).toHaveBeenCalledWith(['--force'])
196+
expect(gitMock.push).toHaveBeenCalledWith(['--no-verify', '--force'])
193197
})
194198

195199
it('should be syncable, have the environment flag set to true, but not be a merge commit', async () => {
@@ -265,9 +269,13 @@ describe('Git controller', () => {
265269
'destination/destinationBranch',
266270
)
267271
expect(gitMock.merge).toHaveBeenCalledTimes(1)
268-
expect(gitMock.merge).toHaveBeenCalledWith(['--ff-only', 'sourceBranch'])
272+
expect(gitMock.merge).toHaveBeenCalledWith([
273+
'--no-verify',
274+
'--ff-only',
275+
'sourceBranch',
276+
])
269277
expect(gitMock.push).toHaveBeenCalledTimes(1)
270-
expect(gitMock.push).toHaveBeenCalledWith(['--force'])
278+
expect(gitMock.push).toHaveBeenCalledWith(['--no-verify', '--force'])
271279
})
272280

273281
it('should be syncable, have the environment flag set to true, be a merge commit, but not be a merge to main branch', async () => {
@@ -348,9 +356,13 @@ describe('Git controller', () => {
348356
'destination/destinationBranch',
349357
)
350358
expect(gitMock.merge).toHaveBeenCalledTimes(1)
351-
expect(gitMock.merge).toHaveBeenCalledWith(['--ff-only', 'sourceBranch'])
359+
expect(gitMock.merge).toHaveBeenCalledWith([
360+
'--no-verify',
361+
'--ff-only',
362+
'sourceBranch',
363+
])
352364
expect(gitMock.push).toHaveBeenCalledTimes(1)
353-
expect(gitMock.push).toHaveBeenCalledWith(['--force'])
365+
expect(gitMock.push).toHaveBeenCalledWith(['--no-verify', '--force'])
354366
})
355367

356368
it('should be syncable, have the environment flag set to true, be a merge commit, and be a merge to main branch,', async () => {
@@ -429,6 +441,6 @@ describe('Git controller', () => {
429441
expect(gitMock.reset).toHaveBeenCalledTimes(1)
430442
expect(gitMock.reset).toHaveBeenCalledWith(['--hard', 'HEAD^2'])
431443
expect(gitMock.push).toHaveBeenCalledTimes(1)
432-
expect(gitMock.push).toHaveBeenCalledWith(['--force'])
444+
expect(gitMock.push).toHaveBeenCalledWith(['--no-verify', '--force'])
433445
})
434446
})

0 commit comments

Comments
 (0)