libgit2 / libgit2/libgit2sharp
Repository.Checkout() doesn't unstage submodule changes
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- C#
- Sterne
- 3.5k
- Forks
- 925
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
If I have a repo in this status
On branch master
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
modified: App_Data/Submodule
modified: file.txt
with App_Data/Submodule being a git submodule and file.txt is just a normal file.
Running git checkout master --force will put the repo in this condition
On branch master
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: App_Data/Submodule (new commits)
no changes added to commit (use "git add" and/or "git commit -a")
but doing the same from LibGit2Sharp using the following code
using (var repo = new LibGit2Sharp.Repository(RepositoryPath))
{
repo.Checkout("master", new CheckoutOptions { CheckoutModifiers = CheckoutModifiers.Force });
}
leaves the repo in this state
On branch master
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
modified: App_Data/Submodule
Calling reset however works as expected.
using (var repo = new LibGit2Sharp.Repository(RepositoryPath))
{
repo.Reset(ResetMode.Hard, "master");
}
Is that behavior expected from LibGit2Sharp? Should I be calling Reset myself if I want to mirror exactly the same git behavior?
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne mit Repository.Checkout und reproduziere das gezeigte Szenario mit einem bereitgestellten Submodul unter Verwendung von CheckoutModifiers.Force. Vergleiche dessen Ergebnis mit git checkout master --force und dem bestehenden Verhalten von Reset(ResetMode.Hard, "master"); abgeschlossen ist die Aufgabe, wenn Checkout die Änderung am Submodul konsistent mit Git aus dem Staging-Bereich entfernt oder die Abweichung als erwartetes Verhalten dokumentiert ist.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- csharp, git
- Bereich
- tooling
- Issue-Typ
- Bug
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 35/100