diff --git a/packages/backend-common/src/scm/git.test.ts b/packages/backend-common/src/scm/git.test.ts index 96c0f919a7..9af080a782 100644 --- a/packages/backend-common/src/scm/git.test.ts +++ b/packages/backend-common/src/scm/git.test.ts @@ -46,15 +46,15 @@ describe('Git', () => { it('should call isomorphic-git with the correct arguments', async () => { const git = Git.fromAuth({}); const dir = 'mockdirectory'; - const remoteName = 'origin'; + const remote = 'origin'; const url = 'git@github.com/something/sads'; - await git.addRemote({ dir, remoteName, url }); + await git.addRemote({ dir, remote, url }); expect(isomorphic.addRemote).toHaveBeenCalledWith({ fs, dir, - remote: remoteName, + remote, url, }); }); @@ -224,18 +224,18 @@ describe('Git', () => { name: 'comitter', email: 'test@backstage.io', }; - const headBranch = 'master'; - const baseBranch = 'production'; + const theirs = 'master'; + const ours = 'production'; const git = Git.fromAuth({}); - await git.merge({ dir, headBranch, baseBranch, author, committer }); + await git.merge({ dir, theirs, ours, author, committer }); expect(isomorphic.merge).toHaveBeenCalledWith({ fs, dir, - ours: baseBranch, - theirs: headBranch, + ours, + theirs, author, committer, }); @@ -244,7 +244,7 @@ describe('Git', () => { describe('push', () => { it('should call isomorphic-git with the correct arguments', async () => { - const remoteName = 'origin'; + const remote = 'origin'; const dir = '/some/mock/dir'; const auth = { username: 'blob', @@ -252,12 +252,12 @@ describe('Git', () => { }; const git = Git.fromAuth(auth); - await git.push({ dir, remoteName }); + await git.push({ dir, remote }); expect(isomorphic.push).toHaveBeenCalledWith({ fs, http, - remote: remoteName, + remote, dir, onProgress: expect.any(Function), headers: { @@ -267,7 +267,7 @@ describe('Git', () => { }); }); it('should pass a function that returns the authorization as the onAuth handler', async () => { - const remoteName = 'origin'; + const remote = 'origin'; const dir = '/some/mock/dir'; const auth = { username: 'blob', @@ -275,7 +275,7 @@ describe('Git', () => { }; const git = Git.fromAuth(auth); - await git.push({ remoteName, dir }); + await git.push({ remote, dir }); const { onAuth } = ((isomorphic.push as unknown) as jest.Mock< typeof isomorphic['push'] diff --git a/packages/backend-common/src/scm/git.ts b/packages/backend-common/src/scm/git.ts index 690f464d35..31b19ac327 100644 --- a/packages/backend-common/src/scm/git.ts +++ b/packages/backend-common/src/scm/git.ts @@ -46,16 +46,16 @@ export class Git { async addRemote({ dir, url, - remoteName, + remote, }: { dir: string; - remoteName: string; + remote: string; url: string; }) { this.config.logger?.info( - `Creating new remote {dir=${dir},remoteName=${remoteName},url=${url}}`, + `Creating new remote {dir=${dir},remote=${remote},url=${url}}`, ); - return git.addRemote({ fs, dir, remote: remoteName, url }); + return git.addRemote({ fs, dir, remote, url }); } async commit({ @@ -130,34 +130,35 @@ export class Git { // https://isomorphic-git.org/docs/en/merge async merge({ dir, - headBranch, - baseBranch, + theirs, + ours, author, committer, }: { dir: string; - headBranch: string; - baseBranch?: string; + theirs: string; + ours?: string; author: { name: string; email: string }; committer: { name: string; email: string }; }) { this.config.logger?.info( - `Merging branch '${headBranch}' into '${baseBranch}' for repository {dir=${dir}}`, + `Merging branch '${theirs}' into '${ours}' for repository {dir=${dir}}`, ); - // If baseBranch is undefined, current branch is used. + + // If ours is undefined, current branch is used. return git.merge({ fs, dir, - ours: baseBranch, - theirs: headBranch, + ours, + theirs, author, committer, }); } - async push({ dir, remoteName }: { dir: string; remoteName: string }) { + async push({ dir, remote }: { dir: string; remote: string }) { this.config.logger?.info( - `Pushing directory to remote {dir=${dir},remoteName=${remoteName}}`, + `Pushing directory to remote {dir=${dir},remote=${remote}}`, ); return git.push({ fs, @@ -167,7 +168,7 @@ export class Git { headers: { 'user-agent': 'git/@isomorphic-git', }, - remote: remoteName, + remote: remote, onAuth: this.onAuth, }); } diff --git a/packages/techdocs-common/src/helpers.ts b/packages/techdocs-common/src/helpers.ts index 8f59ead6fc..f70b0f3840 100644 --- a/packages/techdocs-common/src/helpers.ts +++ b/packages/techdocs-common/src/helpers.ts @@ -170,8 +170,8 @@ export const checkoutGitRepository = async ( await git.fetch({ dir: repositoryTmpPath, remote: 'origin' }); await git.merge({ dir: repositoryTmpPath, - headBranch: `origin/${currentBranchName}`, - baseBranch: currentBranchName || undefined, + theirs: `origin/${currentBranchName}`, + ours: currentBranchName || undefined, author: { name: 'Backstage TechDocs', email: 'techdocs@backstage.io' }, committer: { name: 'Backstage TechDocs', diff --git a/plugins/scaffolder-backend/src/scaffolder/stages/publish/helpers.ts b/plugins/scaffolder-backend/src/scaffolder/stages/publish/helpers.ts index bf19c2f56d..796e48b8f8 100644 --- a/plugins/scaffolder-backend/src/scaffolder/stages/publish/helpers.ts +++ b/plugins/scaffolder-backend/src/scaffolder/stages/publish/helpers.ts @@ -59,11 +59,11 @@ export async function initRepoAndPush({ await git.addRemote({ dir, url: remoteUrl, - remoteName: 'origin', + remote: 'origin', }); await git.push({ dir, - remoteName: 'origin', + remote: 'origin', }); }