Add ignoreRenames option to fileHistoryWalk

未关闭
#1,891 2 条评论 4 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
42/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
停滞
技术栈
cpp, git, javascript
领域
api, performance

调研方向

从 generate/templates/manual/revwalk/file_history_walk.cc 中列出的两个 git_diff_find_similar 调用开始,并检查 fileHistoryWalk 如何接受其参数。当 ignoreRenames 选项为 true 时跳过这两个调用,同时在其他情况下保留现有行为,即表示完成;请根据周围的实现验证该选项的 API 形式。

由索引模型根据 Issue 内容生成。

描述

fileHistoryWalk can take a very long time (eg 15 seconds) if there are commits that change the structure of the repo with a lot of renames.

It's due to the calls to git_diff_find_similar from libgit2 that basically do a O(n²) loop, where n is the number of files added/removed in a commit.

Oftentimes the use of fileHistoryWalk is just to get the last commit that changes a file, for this it's not needed to call git_diff_find_similar.

We could add a third parameter with of the shape {ignoreRenames: boolean} that if true will skip the calls to git_diff_find_similar here:

主要语言
JavaScript
星标
5.8k
派生
704
PR 合并指标
30 天内没有已合并 PR

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

nodegit/nodegit 的其他 Issue

查看 nodegit/nodegit 的全部 Issue

相似的 Issue

更多 JavaScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。