Merge pull request #6195 from shoukoo/shoukoo.add-default-branch

feat: add default branch prop for publish:github action
This commit is contained in:
Ben Lambert
2021-07-02 10:33:24 +02:00
committed by GitHub
7 changed files with 95 additions and 5 deletions
+2 -1
View File
@@ -184,8 +184,9 @@ export class Git {
logger?: Logger | undefined;
}) => Git;
// (undocumented)
init({ dir }: {
init({ dir, defaultBranch, }: {
dir: string;
defaultBranch?: string;
}): Promise<void>;
// (undocumented)
merge({ dir, theirs, ours, author, committer, }: {
+3 -1
View File
@@ -201,14 +201,16 @@ describe('Git', () => {
describe('init', () => {
it('should call isomorphic-git with the correct arguments', async () => {
const dir = '/some/mock/dir';
const defaultBranch = 'master';
const git = Git.fromAuth({});
await git.init({ dir });
await git.init({ dir, defaultBranch });
expect(isomorphic.init).toHaveBeenCalledWith({
fs,
dir,
defaultBranch,
});
});
});
+8 -1
View File
@@ -150,12 +150,19 @@ export class Git {
});
}
async init({ dir }: { dir: string }): Promise<void> {
async init({
dir,
defaultBranch = 'master',
}: {
dir: string;
defaultBranch?: string;
}): Promise<void> {
this.config.logger?.info(`Init git repository {dir=${dir}}`);
return git.init({
fs,
dir,
defaultBranch,
});
}