Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

GitPython parsing 'C'-type diffs incorrectly #932

Closed
@joaopenteado

Description

Hello,

I'm using GitPython 3.0.2 and noticed that git.Diffable cannot properly handle copied files (C). I realize this kind of change type is seldom used so it might be a known issue, but since I couldn't find anyone reporting it I thought I'd just make sure that everyone's aware of it.

How to reproduce

Prepare the demo repo:

mkdir test
cd test
git init
dd if=/dev/urandom of=test1.txt bs=1M count=1
git add . && git commit -m "1"
cp test1.txt test2.txt
git add . && git commit -m "2"

On Python

from git import Repo
from os import getcwd
hcommit = Repo(getcwd()).head.commit
diffs = hcommit.diff('HEAD~1', R=True, find_copies_harder=True)

You will observe that:

  • diffs[0].change_type correctly outputs C instead of C100
  • Both diffs[0].a_path and diffs[0].b_path will output test1.txt\ttest2.txt intead of a_path being test1.txt and b_path being test2.txt.

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        AltStyle によって変換されたページ (->オリジナル) /