Merge pull request #26963 from rjdecilos/fix/createbranch-githelper

Fix/createbranch githelper
This commit is contained in:
Ben Lambert
2024-10-07 13:23:29 +02:00
committed by GitHub
3 changed files with 9 additions and 3 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-scaffolder-node': patch
---
Use `branch` function instead of `checkout` function when creating branch
@@ -32,6 +32,7 @@ jest.mock('../scm', () => ({
init: jest.fn(),
add: jest.fn(),
checkout: jest.fn(),
branch: jest.fn(),
commit: jest
.fn()
.mockResolvedValue('220f19cc36b551763d157f1b5e4a4b446165dbd6'),
@@ -444,7 +445,7 @@ describe('createBranch', () => {
});
it('create the branch', () => {
expect(mockedGit.checkout).toHaveBeenCalledWith({
expect(mockedGit.branch).toHaveBeenCalledWith({
ref: 'trunk',
dir: '/tmp/repo/dir/',
});
@@ -460,7 +461,7 @@ describe('createBranch', () => {
},
});
expect(mockedGit.checkout).toHaveBeenCalledWith({
expect(mockedGit.branch).toHaveBeenCalledWith({
ref: 'trunk',
dir: '/tmp/repo/dir/',
});
@@ -178,7 +178,7 @@ export async function createBranch(options: {
logger,
});
await git.checkout({ dir, ref });
await git.branch({ dir, ref });
}
/**