code: function stageFiles (patterns, ignorePatterns) {
    const baseDir = getBaseDir()
  
    // 如果 baseDir 根本不存在 sgf 会抛出异常
    if (!fs.existsSync(baseDir)) {
      return Promise.resolve([])
    }
  
    sgf.cwd = baseDir
  
    return new Promise(resolve => {
      sgf((err, result) => {
        if (err) {
          debug('staged-git-files error: %o', err)
          return resolve([])
        }
  
        const fileList = result
          .filter(item => item.status !== 'Deleted') // 过滤已删除的文件
          .filter(item => match(item.filename, patterns, ignorePatterns))
          .map(item => item.filename)
  
        resolve(fileList)
      })
    })
  }
docs: Git 暂存文件遍历
  
  @param {Array<string>} patterns 要搜寻的 glob 数组
  @param {Array<string>} ignorePatterns 忽略的 glob 数组
  
  @returns {Promise<object>} fileTree