libgit2 / libgit2/libgit2sharp

How to fetch blobs from remote or alternate repositories

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

還沒有人認領這個 Issue。

主要語言
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. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

研究方向

首先,在 .NET 8 和 LibGit2Sharp 0.31.0 上重現 issue 中描述的 bare repository、alternates 和 blobless fetch 設定。閱讀所引用的 Git partial-clone 文件,並確定應如何從 remote 或 alternates 取得缺失的 blob;完成標準是,回報的缺失物件失敗能夠透過函式庫支援的行為獲得處理。

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

評估

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

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

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