libgit2 / libgit2/libgit2sharp

KeyNotFoundException when trying to iterate through QueryBy result set.

Open
#1,410 10 comments 6 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
3.5k
Forks
925
PR merge metrics
No merged PRs in 30d

Description

I'm trying to get all commits that a particular file is associated with. This is the code that I'm running:

IEnumerable<LogEntry> fileHistory = repo.Commits.QueryBy(fileRelativePath);
foreach (LogEntry version in fileHistory){
 // do something...
}

The foreach throws a KeyNotFoundException. Any idea on how to overcome this?

I'm using: LibGit2Sharp.0.23.1

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the shown repo.Commits.QueryBy(fileRelativePath) call with LibGit2Sharp 0.23.1 and capture where iteration raises KeyNotFoundException. Inspect the QueryBy result path and its handling of the returned commits; done means the file history can be iterated without the exception and the behavior is covered by a regression test.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, git
Domain
devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.