libgit2 / libgit2/libgit2sharp

Repository.Commits.QueryBy is missing changes

Open
#1,752 3 comments 0 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

Reproduction steps

This seems to have been brought up a couple of times already (a quick search showed #1401, #1591, https://github.com/libgit2/libgit2sharp/pull/963#issuecomment-355674649).

This is pretty weird: QueryBy returns 0 LogEntries, while going through all commits and diffing to the previous one shows the same changes/additions/renames as e.g. the SourceTree or Fork UI for the exact same path as for the QueryBy call.

Note that it only does that for some files, most files work fine. I haven't found a common pattern so far (e.g. specific characters, or only merges, or ...) but it looks like QueryBy is omitting merges and that might cause problems.

image
(commits in reverse order)

Expected behavior

QueryBy should return all changes to the file (as outlined in #963 where it was originally added).

Actual behavior

QueryBy returns 0 LogEntries.

Version of LibGit2Sharp (release number or SHA1)

git2-106a5f2

Operating system(s) tested; .NET runtime tested

Win 10, .NET 4.6

EDIT: Maybe I'm understanding the code wrong, but taking a quick peek at https://github.com/libgit2/libgit2sharp/blob/master/LibGit2Sharp/Core/FileHistory.cs#L137, I think QueryBy in fact ignores all commits that have more than 1 parent (e.g. all merges).

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 missing LogEntries for the affected path on Windows/.NET 4.6, comparing QueryBy with the all-commits diff approach described in the issue. Read LibGit2Sharp/Core/FileHistory.cs around line 137, focusing on how commits with multiple parents are handled. Done means QueryBy returns all changes, including merge-related changes, for the affected file.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, git
Domain
devtools
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.