UNPKG

kudo

Version:

check someone's code quality in git repository

31 lines (25 loc) 674 B
/** * @file 读取 commit 的指定文件内容 * @author chris<wfsr@foxmail.com> */ import {git} from './git'; /** * 是否空文件,模拟的 vinyl 文件对象的方法 * * @return {boolean} 恒为 flase */ var isNull = function () { return false; }; /** * 读取某个提交中指定路径的文件内容 * * @param {Commit} commit 提交对象实例 * @param {string} path 要读取的文件路径 */ export default function (commit, path) { function finish(contents) { return {cid: commit.id, path: path, relative: path, contents: contents, isNull: isNull}; } return git.run('show', commit.id + ':' + path).then(finish); };