Libgit2sharp CheckoutPaths() doesn't undo changes on file with status "NewInIndex, ModifiedInWorkdir".

Aberta
#1,984 0 comentários 0 reações 0 responsáveis Ver no GitHub

Ninguém assumiu esta issue ainda.

Avaliação

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

Direção de pesquisa

Comece pela CheckoutPaths API e reproduza a transição de estado relatada para um arquivo marcado como NewInIndex, ModifiedInWorkdir usando o caminho e as CheckoutOptions fornecidos. Verifique se forçar o checkout restaura o conteúdo preparado e deixa o arquivo com o status NewInIndex, usando o comportamento relatado do LibGit2Sharp 0.26.2 como linha de base.

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

Descrição

You are opening a bug report against the LibGit2Sharp project: we
use GitHub Issues for tracking bug reports and feature requests. If
you have a question about an API or usage, please ask on StackOverflow:
http://stackoverflow.com/questions/tagged/libgit2sharp.

Otherwise, to report a bug, please fill out the reproduction steps
(below) and delete these introductory paragraphs. Thanks!

Reproduction steps

I have a file inside many folders (for ex : docs/jsons/myfile.json ) in my repository

I staged the file , so it now has the status "NewInIndex".

After that i made changes on that file.

It has now the status "NewInIndex, ModifiedInWorkdir".

My code is the following :

using ( var repo = new Repository("my repo path")
{
CheckoutOptions options = new CheckoutOptions { CheckoutModifiers = CheckoutModifiers.Force };

repo.CheckoutPaths(repo.Head.FriendlyName, new string[] {"docs/jsons/myfile.json"} , options );
}

I also tried to replace " repo.Head.FriendlyName" by "repo.Head.CannonicalName" and by "repo.Head.Tip.Id.Sha"

Expected behavior

I expect the file to get back to its previous content, and to have the status "NewInIndex" again.

Actual behavior

The file's content doesnt change and its status is still : "NewInIndex, ModifiedInWorkdir".

Version of LibGit2Sharp (release number or SHA1)

LibGit2Sharp version 0.26.2

Operating system(s) tested; .NET runtime tested

Window 10 Enterprise

.NET 6.0

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

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.

Mais de libgit2/libgit2sharp

Todas as issues de libgit2/libgit2sharp

Issues semelhantes

Mais issues de C#

Receba novas issues na sua caixa de entrada

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