libgit2 / libgit2/pygit2

How to save index with "cache tree" extension?

オープン
#1,207 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
Python
スター
1.7k
フォーク
408
平均マージ
2日 57分
マージ済み PR(30日)
7

説明

Hello,

I have a project with approx 2000 files stored on NFS partition. When I initialize repository with pygit2 all subsequent commits took about 5sec. But after I commit anything (even empty tree) via git subsequent commits via pygit2 took only 0.5sec. This is because commit via git writes cache tree (https://git-scm.com/docs/index-format#_cache_tree) extension to .git/index file.

Finally I found that reading tree back to the index builds internal "cache tree". And now I wondering if this is a correct way to buid cache tree on initial commit?

repo = pygit2.init_repository(path, bare=False, flags=pygit2.GIT_REPOSITORY_INIT_NO_REINIT)
index = repo.index
index.add_all()
tree_id = index.write_tree()
# NOTE: Adds "cache tree" extension to the index.
index.read_tree(tree_id)
index.write()
repo.create_commit("HEAD", SIGNATURE, SIGNATURE, "Inital commit", tree_id, [])

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

まず、issue に示されている pygit2.init_repository、index.add_all()、index.write_tree()、index.read_tree()、index.write()、repo.create_commit() の呼び出しから始め、次に index extensions がどのように処理されるかを調べます。結果の index を、多数のファイルがあるリポジトリで git が生成したものと比較します。cache tree がサポートされているかを明らかにし、初回コミットの動作を文書化または修正できれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
git, python
領域
tooling
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
30/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。