libgit2 / libgit2/libgit2sharp

FileHistory return empty enumerable for deleted files

Open
#1,612 3 comments 1 reaction 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
  1. Create a file and commit
  2. Delete the file and commit
  3. Query the log for that specific file: IEnumerable<LogEntry> logs = repo.Commits.QueryBy(fileName);
Expected behavior

The logs enumerable contains 2 entries (initial commit and delete commit)

Actual behavior

The logs enumerable is empty

Version of LibGit2Sharp (release number or SHA1)

v0.25.2

Operating system(s) tested; .NET runtime tested

Windows 7
.Net Framework 4.7.1

Note that git log will also (by default) not return any results when specifying the file name only:

image

However, when telling git explicitly if a revision or a file is specified, git log will show the expected results:

image

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 the repo.Commits.QueryBy(fileName) entry point and reproduce the deleted-file history described in the issue. Compare its handling of the file argument with the git log behavior noted in the report. Done means the query returns both the initial and deletion commits, with a regression test covering that sequence.

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
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.