libgit2 / libgit2/libgit2

support git 2.19's commit-graph

未關閉
#5,757 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

主要語言
C
星號
10.6k
分支
2.7k
PR 合併指標
30 天內沒有已合併 PR

描述

Starting from version 2.19, git supports commit-graph, which allows for some significant improvements in the performance of several graph-based operations. Notably computing the merge base between two (or more) commits and determining whether one commit is ahead/behind of another.

This should be relatively straightforward to implement. Similar to #5399, this can be split into several chunks for ease of reviewing:

  • Support for parsing existing commit-graph files, and a fuzzer because parsing is hard. #5762
  • Support for reading the commit metadata and generation numbers from existing commit-graph files. (in other words, this will ignore any path-based bloom filters). #5763
  • Support knowing whether a commit-graph file has been modified since it was parsed #5764
  • Modify git_commit_list_parse() to take advantage of the commit-graph metadata, if available, which avoids going to the odb, looking up the object, and parsing the commit. #5765
  • Modify the functions mark_parents() and paint_down_to_common() to take advantage of the commit-graph metadata, if available, which can prevent multiple visitations due to commit time inversions. #5766
  • Refactor git_merge__bases_many() so that it can take a minimum generation number. That way git_graph_descendant_of() can specify this minimum generation number to cut down the BFS earlier than what it would in a regular git_merge_base(), and implement git_graph_reachable_from_any() which is analogous to git_merge_base_many() and uses the fancy new git_merge__bases_many() that knows about the minimum generation number. This can be used to have the concept of private/protected/public branches, so that users of a repository have different permissions depending on the reachability of a commit from any of a set of tips. (a.k.a. the whole reason I am writing all of this, ha) #5767
  • Support for creating a commit-graph file from an open repository. #5778
  • Support for creating commit-graph chains, so that the cost of updating a commit-graph is reduced to only the commits that have changed since the last file / chain was written.

Relevant documentation:

貢獻指南

開啟貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

研究方向

從 commit-graph 技術文件以及 libgit2 現有的建立 commit-graph 檔案支援開始,包括此 issue 中連結的已完成工作。追蹤目前更新如何寫入圖資料,然後定義 chain 行為,使更新圖時只處理自上一個檔案或 chain 寫入以來發生變更的提交。完成的標準是可以建立 commit-graph chains,並如所述降低更新成本。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
c, git
領域
devtools
Issue 類型
功能
難度
4/5
預估耗時
3-5 天
活躍度
停滯
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。