Fix keep history (#27)

This commit is contained in:
CrazyMax 2019-11-19 13:15:27 +01:00
parent 6b68dc4210
commit 41ad18c22f
No known key found for this signature in database
GPG Key ID: 3248E46B6BB8C7F7
2 changed files with 2 additions and 2 deletions

View File

@ -58,7 +58,7 @@ function run() {
process.chdir(tmpdir); process.chdir(tmpdir);
const remote_branch_exists = child_process.execSync(`git ls-remote --heads ${remote_url} ${target_branch}`, { encoding: 'utf8' }).trim().length > const remote_branch_exists = child_process.execSync(`git ls-remote --heads ${remote_url} ${target_branch}`, { encoding: 'utf8' }).trim().length >
0; 0;
if (remote_branch_exists) { if (keep_history && remote_branch_exists) {
yield exec.exec('git', ['clone', '--quiet', '--branch', target_branch, '--depth', '1', remote_url, '.']); yield exec.exec('git', ['clone', '--quiet', '--branch', target_branch, '--depth', '1', remote_url, '.']);
} }
else { else {

View File

@ -43,7 +43,7 @@ async function run() {
const remote_branch_exists = const remote_branch_exists =
child_process.execSync(`git ls-remote --heads ${remote_url} ${target_branch}`, {encoding: 'utf8'}).trim().length > child_process.execSync(`git ls-remote --heads ${remote_url} ${target_branch}`, {encoding: 'utf8'}).trim().length >
0; 0;
if (remote_branch_exists) { if (keep_history && remote_branch_exists) {
await exec.exec('git', ['clone', '--quiet', '--branch', target_branch, '--depth', '1', remote_url, '.']); await exec.exec('git', ['clone', '--quiet', '--branch', target_branch, '--depth', '1', remote_url, '.']);
} else { } else {
core.info(`🏃 Initializing local git repo`); core.info(`🏃 Initializing local git repo`);