Skip to content

Commit

Permalink
perf(repository-client): clone only a single branch without history
Browse files Browse the repository at this point in the history
  • Loading branch information
AriPerkkio committed Dec 1, 2020
1 parent ef13bdf commit 07ac720
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/file-client/repository-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ export interface RepositoryClientOptions {
export const URL = 'https://github.com';
export const CACHE_LOCATION = './.cache-eslint-remote-tester';

// Clone only latest history of the main branch
const CLONE_OPTS = { '--depth': 1 } as const;

// Create cache if missing
if (!fs.existsSync(CACHE_LOCATION)) {
fs.mkdirSync(CACHE_LOCATION);
Expand All @@ -34,7 +37,11 @@ export async function cloneRepository({

try {
const git = simpleGit();
await git.clone(`${URL}/${repository}.git`, repoLocation);
await git.clone(
`${URL}/${repository}.git`,
repoLocation,
CLONE_OPTS
);
} catch (e) {
onCloneFailure();
}
Expand Down

0 comments on commit 07ac720

Please sign in to comment.