Skip to content

Commit 0c0d3b1

Browse files
chore: consider local branch
1 parent 6df633b commit 0c0d3b1

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

__tests__/git-helper.test.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,7 @@ describe('GitHelper', () => {
267267

268268
execCalledWith(mockExec, [
269269
'git checkout -b test-branch origin/test-branch || :',
270+
'git checkout test-branch || :',
270271
]);
271272
});
272273
});
@@ -814,14 +815,19 @@ describe('GitHelper', () => {
814815
execCalledWith(mockExec, [
815816
'git clone \'--branch=test\' \'--depth=3\' \'https://octocat:[email protected]/hello/world.git\' \'.\' > /dev/null 2>&1 || :',
816817
'git checkout -b abc origin/abc || :',
818+
'git checkout abc || :',
817819
'git clone \'--branch=test\' \'--depth=3\' origin \'.\' > /dev/null 2>&1 || :',
818820
'git checkout -b abc origin/abc || :',
821+
'git checkout abc || :',
819822
'git clone \'--branch=test\' \'--depth=3\' test \'.\' > /dev/null 2>&1 || :',
820823
'git checkout -b abc test/abc || :',
824+
'git checkout abc || :',
821825
'git clone \'--branch=test\' \'--depth=3\' origin \'.\' || :',
822826
'git checkout -b abc origin/abc || :',
827+
'git checkout abc || :',
823828
'git clone \'--branch=test\' \'--depth=3\' \'https://octocat:[email protected]/hello/world.git\' \'.\' > /dev/null 2>&1 || :',
824829
'git checkout -b abc origin/abc || :',
830+
'git checkout abc || :',
825831
]);
826832
});
827833
});

src/git-helper.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,12 @@ export default class GitHelper {
327327
suppressError: this.shouldSuppressError(),
328328
stderrToStdout: true,
329329
});
330+
await this.runCommand(workDir, {
331+
command: 'git checkout',
332+
args: [branch],
333+
suppressError: this.shouldSuppressError(),
334+
stderrToStdout: true,
335+
});
330336
};
331337

332338
/**

0 commit comments

Comments
 (0)