Skip to content

Tracking empty files #248

@vincenzorrei

Description

@vincenzorrei

Tracking the history of a file, I saw that the class ModifiedFile for empty files can not retrive correctly the info about old_path for them creation (it should be None but we have the same path of new_path) and new_path for them deletion (should be None but it remains the same).
It happens often dealing with "_init_.py"
I think the problem (if it's a problem) could be in parsing the git diff when there are no modified lines.

Here is what happens by parsing your repo for the creation of 'pydriller/tests/integration/_init_.py' :

  • commit: 4be0402
  • ModifiedFile:
    -- old_path = {str} 'pydriller/tests/integration/_init_.py'
    -- source_code_before = {NoneType} None
    -- new_path = {str} 'pydriller/tests/integration/_init_.py'
    -- source_code = {str} ''

with command:
git diff 4be0402~ 4be0402

...
diff --git a/pydriller/tests/integration/_init_.py b/pydriller/tests/integration/_init_.py
new file mode 100644
index 0000000..e69de29
...

Am I missing something?
Thanks for your time.

Metadata

Metadata

Assignees

No one assigned

    Labels

    PR welcomeIssue is confirmed, but not fixed yetbugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions