libgit2 / libgit2/pygit2

Incorrect detection of modified/renamed files

Open
#1,197 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
1.7k
Forks
408
Avg merge
2d 57m
Merged PRs (30d)
7

Description

Test code:

import pygit2
repo = pygit2.Repository(pygit2.discover_repository(<repo_path>))

status = repo.status()
for filepath, flags in status.items():
    print(filepath, flags)

Running Result:

child.py 128
example.py 128
mvv.txt 513
mvvv.txt 4
name2.py 128
parent.py 128
x/mvv.txt 128
x/mvvv.txt 513
x/parent2.py 128
xname.py 128
zname.py 512
zname1.py 128

However, git status given me the result as:

On branch master
Changes to be committed:
  (use "git restore --staged <file>..." to unstage)
        renamed:    mvvv.txt -> mvv.txt
        new file:   x/mvvv.txt

Changes not staged for commit:
  (use "git add/rm <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
        deleted:    mvv.txt
        deleted:    x/mvvv.txt
        deleted:    zname.py

Untracked files:
  (use "git add <file>..." to include in what will be committed)
        .idea/
        child.py
        example.py
        name2.py
        parent.py
        x/mvv.txt
        x/parent2.py
        xname.py
        zname1.py

Which contains the renamed records.

Why this happened?
(If you want the test repo, I can zip it and send to your team mail if anyone provide me one.)

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 with the shown Python snippet and the repo.status() entry point, then reproduce the listed flags against the corresponding git status output. Determine whether the missing or differing rename records are expected behavior or a bug, and document the expected result and a reproducible verification path.

Written by the indexing model from the issue text.

Assessment

Tech stack
git, python
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.