miyagawa / cpanminus

cpanminus - get, unpack, build and install modules from CPAN
http://cpanmin.us
746 stars 213 forks source link

cpanm: use depth 1 when cloning for git repos #663

Open shawnlaffan opened 11 months ago

shawnlaffan commented 11 months ago

Running cpanm on a git repo clones the entire repo. For large repos this can lead to large downloads that take a reasonable amount of time.

So far as I can tell the relevant code is at this line: https://github.com/miyagawa/cpanminus/blob/287cfbda837ab74160a068a4ce21c98b8a0c5b44/Menlo-Legacy/lib/Menlo/CLI/Compat.pm#L1699

Unless I'm missing something only the latest commit should be needed, so this line could be changed to:

$self->run_command([ 'git', 'clone', '--depth', '1', $uri, $dir ]);

Please let me know if a PR would be useful.