Skip to content

Commit

Permalink
Fix Clone fails for all URLs #967
Browse files Browse the repository at this point in the history
  • Loading branch information
nelsonni committed Oct 12, 2022
1 parent 41063f8 commit 388b5ff
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/containers/git/git-clone.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { PathLike } from 'fs-extra';
import { dirname } from 'path';
import { execute } from '../utils';

/**
Expand Down Expand Up @@ -31,11 +32,12 @@ export const cloneRepo = async ({
singleBranch?: boolean;
noCheckout?: boolean;
}): Promise<boolean> => {
const parentDir = dirname(dir.toString()); // the `dir` directory doesn't exist yet, so start from parent
const bareOption = bare ? `--bare` : '';
const noCheckoutOption = noCheckout ? `--no-checkout` : '';
const singleBranchOption = singleBranch ? `--single-branch` : '';
const branchOption = branch ? `--branch ${branch}` : '';
const output = await execute(`git clone ${repo.toString()} ${dir.toString()} ${branchOption} ${bareOption} ${noCheckoutOption} ${singleBranchOption}`, dir.toString());
const output = await execute(`git clone ${repo.toString()} ${dir.toString()} ${branchOption} ${bareOption} ${noCheckoutOption} ${singleBranchOption}`, parentDir.toString());

if (output.stderr.length > 0) {
console.error(output.stderr);
Expand Down

0 comments on commit 388b5ff

Please sign in to comment.