libgit2 / libgit2/libgit2sharp

Update bundled libgit2 to >= 1.9.4 for relativeWorktrees support

Aberta
#2,184 1 comentário 0 reações 0 responsáveis Ver no GitHub

Ninguém assumiu esta issue ainda.

Linguagem predominante
C#
Estrelas
3.5k
Forks
925
Métricas de merge de PRs
Nenhum PR com merge em 30d

Descrição

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.

Guia de contribuição

Abrir o guia de contribuição

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Direção de pesquisa

Comece pelo ponto de entrada do construtor de Repository e pela configuração nativa do libgit2 incluída no projeto. Reproduza a falha usando um worktree com extensions.relativeWorktrees habilitado e, em seguida, verifique se a versão incluída do libgit2 é pelo menos 1.9.4 e se a abertura do repositório funciona no Linux/.NET 8.0.

Escrita pelo modelo de indexação a partir do texto da issue.

Avaliação

Stack de tecnologia
csharp, git
Domínio
build-system
Tipo de issue
Bug
Dificuldade
3/5
Tempo estimado
1-2 dias
Status de atividade
Pouca atividade
Clareza
Razoavelmente clara
Facilidade para iniciantes
48/100

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.