libgit2 / libgit2/libgit2sharp

TreeEntryChange status is set incorrectly when doing Diff (Deleted instead of Renamed)

Open
#1,526 2 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

I took a diff between 42b22ab5fe78889aae058c3af342ea67b30b48d5 and e315208fe33d43964fb649935e3bbff2275fa101 which are two consecutive commits in Roslyn codebase. As you can see Github shows the status of all changes as renamed but libgit2sharp detects them as deleted.

Steps to reproduce:

  1. Clone Roslyn's repo
  2. Take a diff between these commits
foreach (TreeEntryChanges change in repo
                    .Diff.Compare<TreeChanges>(commitParents.Single().Tree, commit.Tree, compareOptions: compareOptions))
                {
                    // for all chnages change.Status=ChangeKind.Deleted
                }

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

Reproduce the diff between commits 42b22ab5fe78889aae058c3af342ea67b30b48d5 and e315208fe33d43964fb649935e3bbff2275fa101 using the shown TreeChanges comparison. Trace how TreeEntryChanges assigns ChangeKind for these changes; done means the affected entries report Renamed rather than Deleted.

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
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.