libgit2 / libgit2/libgit2sharp

Repositories with git-dir and work-dir should't create .git file in working directory

Aperta
#1,716 1 commento 3 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

Repository.Init("/working/path", "/git/path");

Expected behavior

For most cases the whole point of doing this separation of working directory and git directory is to avoid the existence of .git file/folder in working directory

Actual behavior

The repo_is_worktree in repository.c of libgit2, should not checking for gitdir in working directory.
In config file, in git directory there is a field worktree = /working/path which could be used to find out which is the working directory.

My suggestion would be, in private Repository constructor to get the worktree value from config file in git-directory and pass it to the Proxy.git_repository_set_workdir in Repository class
instead of reading the value from options that were given from caller.
Future improvement would be not event passing the working directory, because it can be extracted from config file.

Hope to hear soon your opinion on this
Max

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 con Repository.Init e il costruttore privato di Repository, quindi esamina Repository.cs intorno a Proxy.git_repository_set_workdir. Confronta quel percorso con repo_is_worktree e la gestione di gitdir in src/repository.c, utilizzando il valore di worktree nella configurazione della directory Git come descritto. Riproduci il problema con percorsi di lavoro e Git separati e verifica che l'inizializzazione non crei più un file .git nella directory di lavoro.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
csharp, git
Ambito
tooling
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.