Skip to content

Commit

Permalink
Merge branch 'master' into fix-env-aliases
Browse files Browse the repository at this point in the history
  • Loading branch information
dacbd authored Oct 31, 2022
2 parents 91cc8d6 + fc9e235 commit 903aacd
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 13 deletions.
4 changes: 1 addition & 3 deletions bin/cml/repo/prepare.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@ exports.builder = (yargs) =>
exports.options = kebabcaseKeys({
fetchDepth: {
type: 'number',
default: 1,
description:
'Number of commits to fetch. 0 indicates all history for all branches and tags'
description: 'Number of commits to fetch (use `0` for all branches & tags)'
},
unshallow: {
type: 'boolean',
Expand Down
4 changes: 2 additions & 2 deletions bin/cml/repo/prepare.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ describe('CML e2e', () => {
--help Show help [boolean]
Options:
--fetch-depth Number of commits to fetch. 0 indicates all history for all
branches and tags [number] [default: 1]
--fetch-depth Number of commits to fetch (use \`0\` for all branches & tags)
[number]
--user-email Git user email [string] [default: \\"[email protected]\\"]
--user-name Git user name [string] [default: \\"Olivaw[bot]\\"]"
`);
Expand Down
16 changes: 8 additions & 8 deletions src/cml.js
Original file line number Diff line number Diff line change
Expand Up @@ -501,19 +501,19 @@ class CML {
userName = GIT_USER_NAME,
remote = GIT_REMOTE
} = opts;
let { fetchDepth = 1 } = opts;
const { fetchDepth = unshallow ? 0 : undefined } = opts;

const driver = this.getDriver();
await exec(await driver.updateGitConfig({ userName, userEmail, remote }));
if (unshallow) {
if ((await exec('git rev-parse --is-shallow-repository')) === 'true') {
fetchDepth = 0;
if (fetchDepth !== undefined) {
if (fetchDepth <= 0) {
if ((await exec('git rev-parse --is-shallow-repository')) === 'true') {
return await exec('git fetch --all --unshallow');
}
} else {
return await exec(`git fetch --all --depth=${fetchDepth}`);
}
}
if (fetchDepth <= 0) {
return await exec('git fetch --all --unshallow');
}
return await exec(`git fetch --all --depth=${fetchDepth}`);
}

async prCreate(opts = {}) {
Expand Down

2 comments on commit 903aacd

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test Comment

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test Comment

Please sign in to comment.