libgit2 / libgit2/libgit2sharp

GitRepo.Commits.QueryBy(fpath) fails with "Given key not present in dictionary" for some folders only on master branch!

Open
#1,520 5 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

I use this code:

GitRepo = new Repository(Repository.Discover(SolutionDir));

string fpath = folder.Replace(SolutionDir, string.Empty).Replace("\", "/").TrimStart('/');

        foreach (var c in GitRepo.Commits.QueryBy(fpath).Take(1))
        {
            revisionsList.Add(folder.Split(Path.DirectorySeparatorChar).Last(), c.Commit.Committer.When.ToUnixTimeSeconds());
        }

The GitRepo.Commits.QueryBy(fpath) fails for some folders on master branch and only on master.

It works fine when you run it of a branch made from master.

I tried to get back the version of the library and found this code works in v0.22.1 from nuget.

It fails for 0.23.0, 0.23.1, 0.24.0 - all tested to fail.

If you can fix it in 0.24.1 will be great.

Thanks,

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 at GitRepo.Commits.QueryBy(fpath) and reproduce the dictionary exception for the affected folders on master, comparing with a branch created from master. Compare behavior between v0.22.1 and v0.23.0–v0.24.0; done means the same paths no longer fail on master while still returning the expected commit data.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, git
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.