libgit2 / libgit2/libgit2sharp

Exception while trying to retrieve last commit from shallow repo

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

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

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

説明

In my custom MSBuild task code tries to get last commit hash to put it into one of assembly attributes. Task works very well with repositories cloned with full depth but fails with the following error in repositories with limited depth created with command git clone --depth xx - where xx is number of last commits to clone.

/home/travis/build/DjvuNet/DjvuNet/DjvuNetBuild.Core.targets(20,5): error :
 LibGit2Sharp.NotFoundException: 
object not found - no match for id (d53e5a7166904479d42953bd0f91264f5ace1f6d)
[/home/travis/build/DjvuNet/DjvuNet/DjvuNet.NETStandard2.0/DjvuNet.NETStandard2.0.csproj] 

Code used to retrieve commit data is as follows:

    Repository repo = new Repository(RepoRoot);
    var commits = repo.Commits;
    var commit = commits.FirstOrDefault();

Seems to be libgit2sharp implementation bug as git fully supports enumeration of limited depth repos.

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

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

はじめの一歩

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

調査の方向性

レポートに示されている Repository.Commits エントリポイントから開始し、git clone --depth xx で作成したリポジトリを使って失敗を再現してください。shallow リポジトリの列挙結果を報告されている NotFoundException と比較し、その後、最初のコミットの取得が missing-object エラーなしで成功することを確認してください。issue では特定のテストファイルは指定されていません。

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

評価

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

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

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