libgit2 / libgit2/libgit2sharp
Libgit2sharp CheckoutPaths() doesn't undo changes on file with status "NewInIndex, ModifiedInWorkdir".
Nessuno ha ancora preso questa issue.
- Lingua principale
- C#
- Stelle
- 3.5k
- Fork
- 925
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
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
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Iniziare con la CheckoutPaths API e riprodurre la transizione di stato segnalata per un file contrassegnato come NewInIndex, ModifiedInWorkdir utilizzando il percorso e le CheckoutOptions fornite. Verificare che il checkout forzato ripristini il contenuto nell’area di staging e lasci il file con lo stato NewInIndex, usando come riferimento il comportamento segnalato di LibGit2Sharp 0.26.2.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- csharp, git
- Ambito
- devtools
- Tipo di issue
- Bug
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 45/100