Skip to content

Commit

Permalink
feat(git-fetcher): shallow clone when fetching git resource
Browse files Browse the repository at this point in the history
  • Loading branch information
kenrick95 committed Apr 11, 2022
1 parent 905d19e commit d5d20f6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/curly-spiders-search.md
@@ -0,0 +1,5 @@
---
"@pnpm/git-fetcher": minor
---

feat(git-fetcher): shallow clone when fetching git resource
4 changes: 3 additions & 1 deletion packages/git-fetcher/src/index.ts
Expand Up @@ -18,7 +18,9 @@ export default () => {
}
) {
const tempLocation = await cafs.tempDir()
await execGit(['clone', resolution.repo, tempLocation])
await execGit(['init'], { cwd: tempLocation })
await execGit(['remote', 'add', 'origin', resolution.repo], { cwd: tempLocation })
await execGit(['fetch', '--depth', '1', 'origin', resolution.commit], { cwd: tempLocation })
await execGit(['checkout', resolution.commit], { cwd: tempLocation })
await preparePackage(tempLocation)
// removing /.git to make directory integrity calculation faster
Expand Down

0 comments on commit d5d20f6

Please sign in to comment.