libgit2 / libgit2/libgit2sharp

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

Offen
#1,984 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Vorherrschende Sprache
C#
Sterne
3.5k
Forks
925
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

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

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginnen Sie mit der CheckoutPaths API und reproduzieren Sie die gemeldete Zustandsänderung für eine Datei mit dem Status NewInIndex, ModifiedInWorkdir unter Verwendung des angegebenen Pfads und der CheckoutOptions. Überprüfen Sie, dass das Erzwingen des Checkouts den bereitgestellten Inhalt wiederherstellt und die Datei den Status NewInIndex behält, wobei das gemeldete Verhalten von LibGit2Sharp 0.26.2 als Grundlage dient.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
csharp, git
Bereich
devtools
Issue-Typ
Bug
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
45/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.