libgit2 / libgit2/libgit2sharp
Repository.Checkout() doesn't unstage submodule changes
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
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?
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
Inizia con Repository.Checkout e riproduci lo scenario mostrato con un sottomodulo in staging usando CheckoutModifiers.Force. Confronta il risultato con git checkout master --force e con il comportamento esistente di Reset(ResetMode.Hard, "master"); il lavoro è completato quando Checkout rimuove dallo staging la modifica al sottomodulo in modo coerente con Git, oppure quando la differenza viene documentata come comportamento previsto.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- csharp, git
- Ambito
- tooling
- Tipo di issue
- Bug
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100