加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
enable-lfs-hooks.js 800 Bytes
一键复制 编辑 原始数据 按行查看 历史
ckrishnakumar 提交于 2019-04-02 14:56 . fix some linting issue
//@flow
const fs = require('fs');
const modifyHook = ['pre-push', 'post-checkout', 'post-commit', 'post-merge'];
const command = `command -v git-lfs >/dev/null 2>&1`;
const message = `{ echo >&2 "\n repository is configured for Git LFS but 'git-lfs' was not found on your path. Refer to Atlaskit document https://product-fabric.atlassian.net/wiki/spaces/FBT/pages/864979766/Enabling+git-lfs+on+Atlaskit"; exit 2; }`;
const hookfiles = [];
modifyHook.forEach(hook => {
hookfiles.push(`.git/hooks/${hook}`);
});
console.log('updating hooks -', hookfiles); //eslint-disable-line no-console
hookfiles.forEach(file => {
fs.appendFileSync(file, `\n${command} || ${message} \n`);
const hook = file.split('/')[2];
const lfscmd = `\ngit lfs ${hook} "$@" `;
fs.appendFileSync(file, lfscmd);
});
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化