libgit2 / libgit2/pygit2

Incorrect detection of modified/renamed files

未关闭
#1,197 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

主要语言
Python
星标
1.7k
派生
408
平均合并
2 天 57 分钟
30 天内合并 PR
7

描述

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.)

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从所示的 Python 代码片段和入口点 repo.status() 开始,然后针对相应的 git status 输出重现列出的 flags。确定缺失或不同的重命名记录是预期行为还是 bug,并记录预期结果和可复现的验证路径。

由索引模型根据 Issue 内容生成。

评估

技术栈
git, python
领域
tooling
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
需要澄清
新手友好度
28/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。