libgit2 / libgit2/libgit2sharp

Commands.Stage() fails with a submodule

Aperta
#1,877 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

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

Reproduction steps
  1. Add a submodule to a Git repository like git submodule add ../test-module test-module
  2. Change the commit of the submodule like cd test-module; git checkout -b branch-name
  3. Try to stage the submodule using libgit2sharp with Commands.Stage("*") or with Commands.Stage("test-module")
Expected behavior

The submodule change should be staged.

Actual behavior

An exception is thrown because git_index_add_bypath() failed because the path is invalid: test-module/

Commands.Stage() adds a slash at the end of the submodule name it passes to git_index_add_bypath which causes it to fail. git_index_add_bypath works fine passing it test-module directly with repo.Index.Add("test-module") (which is a workaround I'll use for now).

Version of LibGit2Sharp (release number or SHA1)

LibGit2Sharp 0.26.2

Operating system(s) tested; .NET runtime tested

.NET Framework 4.7.2 on Windows 10

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia dal punto di ingresso Commands.Stage e riproduci il caso del submodule descritto con Commands.Stage("*") e Commands.Stage("test-module"). Confronta la gestione dei percorsi con repo.Index.Add("test-module"), che viene indicato come workaround. Il lavoro è completato quando il submodule modificato può essere messo in stage senza l’errore del percorso con slash finale.

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
Specificata chiaramente
Idoneità per principianti
45/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.