libgit2 / libgit2/libgit2sharp
View Incoming Commits from a Pre-Receive Hook
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
I have developed a pre-receive hook using C#/.NET and used libgit2sharp to retrieve the commits that are being pushed from the client. When I access the Repository.Commits, I only see the old commits not the ones that are being pushed.
I tried using a bash script to implement the hook and execute git rev-list $rev_old..$rev_new and it works and I can see the commits.
So, I'm wondering why does the bash script work and the C#/.NET executable does not given that both executables are executing on the same working directory that Git assigns to the hook.
P.S. I'm using BitBucket Server on-premise deployment - it shouldn't matter I think because the hook works at the Git level not BitBucket
Reproduction steps
- Create a .NET 6.0 Console application and add a reference to
libgit2sharp. - Write code to obtain the commits between the old ref and the new ref as provided by Git.
- Build and configure the hook on the Git repository directory.
- Use a Git client to push commits to the server.
Expected behavior
The commits coming from the client should be seen when the Repository.Commits is enumerated.
Actual behavior
Only the commits before the push are returned not the incoming commits.
Version of LibGit2Sharp (release number or SHA1)
0.26.2
Operating system(s) tested; .NET runtime tested
Ubuntu 18.04 and .NET 6.0
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 riproducendo il pre-receive hook con libgit2sharp 0.26.2 su Ubuntu 18.04 e .NET 6.0, confrontando Repository.Commits con i valori di ref precedenti e nuovi forniti da Git. Leggi gli argomenti ref dell’hook e il comportamento di Repository.Commits; il lavoro è completato quando i commit in ingresso sono osservabili oppure quando sono documentati il limite e l’utilizzo corretto.
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
- Da chiarire
- Idoneità per principianti
- 35/100