libgit2 / libgit2/libgit2sharp

View Incoming Commits from a Pre-Receive Hook

オープン
#1,977 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
C#
スター
3.5k
フォーク
925
PR マージ指標
30日以内にマージされた PR はありません

説明

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

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

まず、Ubuntu 18.04 と .NET 6.0 上で libgit2sharp 0.26.2 を使って pre-receive hook を再現し、Repository.Commits と Git から提供される古い ref 値および新しい ref 値を比較します。hook の ref 引数と Repository.Commits の動作を確認します。受信したコミットを観測できるか、制限事項と正しい使用方法が文書化されていれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
csharp, git
領域
tooling
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。