libgit2 / libgit2/libgit2sharp

View Incoming Commits from a Pre-Receive Hook

Offen
#1,977 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Vorherrschende Sprache
C#
Sterne
3.5k
Forks
925
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

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
  1. Create a .NET 6.0 Console application and add a reference to libgit2sharp.
  2. Write code to obtain the commits between the old ref and the new ref as provided by Git.
  3. Build and configure the hook on the Git repository directory.
  4. 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

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne damit, den pre-receive hook mit libgit2sharp 0.26.2 unter Ubuntu 18.04 und .NET 6.0 zu reproduzieren, indem du Repository.Commits mit den von Git bereitgestellten alten und neuen ref-Werten vergleichst. Lies die ref-Argumente des Hooks und das Verhalten von Repository.Commits; als erledigt gilt, wenn die eingehenden Commits beobachtbar sind oder die Einschränkung und die korrekte Verwendung dokumentiert sind.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
csharp, git
Bereich
tooling
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Muss geklärt werden
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.