libgit2 / libgit2/libgit2sharp

Update bundled libgit2 to >= 1.9.4 for relativeWorktrees support

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

還沒有人認領這個 Issue。

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

描述

Reproduction steps

Use LibGit2Sharp to open a repository/worktree created by Git with relative worktree paths enabled. Modern Git can set this automatically when a worktree is created or repaired with relative paths.

A minimal repository state has core.repositoryformatversion = 1 and the newer Git extension:

[extensions]
    relativeWorktrees = true

A linked worktree may have a .git file like:

gitdir: ../worktrees/my-worktree

Then open the worktree with LibGit2Sharp:

using LibGit2Sharp;

using var repo = new Repository("/path/to/my-worktree");

This also reproduces through downstream tools that depend on LibGit2Sharp. In my case, GitVersion.MsBuild 6.7.0 launches its bundled GitVersion tool, which bundles LibGit2Sharp 0.31.0 and native libgit2 1.8.4, and fails while opening the repository.

Expected behavior

LibGit2Sharp should open repositories/worktrees that use Git's extensions.relativeWorktrees extension.

The upstream libgit2 issue was fixed here:

The fix is included in libgit2 v1.9.4:

Actual behavior

Opening the repository fails before any repository operations can run:

LibGit2Sharp.LibGit2SharpException: unsupported extension name extensions.relativeworktrees
   at LibGit2Sharp.Core.Ensure.HandleError(Int32 result)
   at LibGit2Sharp.Core.Ensure.ZeroResult(Int32 result)
   at LibGit2Sharp.Core.Proxy.git_repository_open(String path)
   at LibGit2Sharp.Repository..ctor(String path, RepositoryOptions options, RepositoryRequiredParameter requiredParameter)
   at LibGit2Sharp.Repository..ctor(String path)
Version of LibGit2Sharp (release number or SHA1)

Observed via downstream GitVersion.MsBuild 6.7.0, which bundles:

LibGit2Sharp 0.31.0
native libgit2 1.8.4

The requested dependency update is for a LibGit2Sharp release that bundles native libgit2 >= 1.9.4.

Operating system(s) tested; .NET runtime tested

Tested on Linux / WSL2 with .NET 8.0.

Git version in the environment:

git version 2.51.2
Downstream dependency-chain impact

This blocks tools that consume LibGit2Sharp indirectly, notably GitVersion. I am filing a corresponding GitVersion issue as well, because GitVersion cannot fix this until LibGit2Sharp publishes a release with libgit2 >= 1.9.4.

貢獻指南

開啟貢獻指南

從這裡開始

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

研究方向

從 Repository 建構函式進入點和專案中隨附的原生 libgit2 設定開始。使用啟用 extensions.relativeWorktrees 的 worktree 重現此失敗,然後確認隨附的 libgit2 版本至少為 1.9.4,並驗證在 Linux/.NET 8.0 上可以成功開啟存放庫。

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

評估

技術堆疊
csharp, git
領域
build-system
Issue 類型
缺陷
難度
3/5
預估耗時
1-2 天
活躍度
冷清
描述清晰度
基本清楚
新手友好度
48/100

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

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