libgit2 / libgit2/libgit2sharp
How to fetch blobs from remote or alternate repositories
还没有人认领这个 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
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 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