我正在尝试使用simple-git创建浅表克隆。我正在尝试创建与此命令等效的命令:git clone --depth 1 https://github.com/steveukx/git-js.git
。我的代码如下:
const git = require('simple-git')()
const repoURL = 'https://github.com/steveukx/git-js.git';
const localPath= './git-js';
const options = ['--depth','1'];
const handlerFn = () => {
console.log('DONE')
};
git.clone(repoURL,localPath,options,handlerFn());
我在--depth 1
中指定了options
,但是代码复制了整个回购历史记录,似乎完全忽略了给定的选项。我这样做是否正确,什么会导致这种行为?