libgit2 / libgit2/libgit2sharp

How to fetch blobs from remote or alternate repositories

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

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

主要言語
C#
スター
3.5k
フォーク
925
PR マージ指標
30日以内にマージされた PR はありません

説明

For CI processes we have repositories that are cloned with "--filter=blob:none".
Also we have a repository cache folder that we set via ".git/objects/info/alternates".

When we try to access the blob contend it fails, is there a way to download the blob from the remote repository?
For alternates objects I can probably just copy the objects over manually but I would prefer proper lib support.

What I'm looking for is something like https://git-scm.com/docs/partial-clone/2.49.0#_fetching_missing_objects
Manly ideas how to custom implement this or an integrated solution when using the lib.

Reproduction steps

Example repo setup:

git init $GITHUB_WORKSPACE/git --bare
git remote add origin git@github.com:${{ github.repository }}.git
echo "/git-cache/${{ github.repository }}.git/objects" >> ./objects/info/alternates
git fetch --no-tags --no-recurse-submodules --filter=blob:none origin ${{ env.DefaultBranch }}

Actual behavior

Depending on function: No valid git object identified by 'sha xxxxxx' exists in the repository.

Version of LibGit2Sharp (release number or SHA1)

0.31.0

Operating system(s) tested; .NET runtime tested

Win 11 / Debian | Net Core 8

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

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

はじめの一歩

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

調査の方向性

まず、issue に記載されている bare repository、alternates、blobless fetch のセットアップを .NET 8 と LibGit2Sharp 0.31.0 で再現します。参照されている Git の partial-clone ドキュメントを読み、不足している blob を remote または alternates からどのように取得すべきかを確認します。不足しているオブジェクトに関して報告された失敗が、ライブラリでサポートされている動作によって処理されれば完了です。

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

評価

技術スタック
csharp, git
領域
devtools
issue の種類
機能追加
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

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

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