libgit2 / libgit2/libgit2sharp

Update bundled libgit2 to >= 1.9.4 for relativeWorktrees support

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

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

主要言語
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. リポジトリをフォークし、ブランチを切って変更します。
  4. 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 を短くまとめたダイジェスト。