Skip to content

ProcessException on change file if only mode changes #227

Closed
@Patrick-Beuks

Description

@Patrick-Beuks

The code throws and ProcessException when trying to execute functions (getContent, isBinary) on a file diff if the diff does not contain an index. This can happen when only the mode changes.

Full error:

Error while running git command:
'git' '--git-dir' '<LOCAL_DIR>' 'cat-file' '-p' ""

fatal: Not a valid object name 

Diff file:

diff --git a/a.out b/a.out
old mode 100755
new mode 100644

Parsed diff file object:

[Gitonomy\Git\Diff\File](<LOCAL_DIR>/vendor/gitonomy/gitlib/src/Gitonomy/Git/Diff/File.php#L20) {#5962 ▼
    #oldName: "a.out"
    #newName: "a.out"
    #oldMode: "100755"
    #newMode: "100644"
    #oldIndex: ""
    #newIndex: ""
    #isBinary: false
    #changes: []
    #repository: [Gitonomy\Git\Repository](<LOCAL_DIR>/vendor/gitonomy/gitlib/src/Gitonomy/Git/Repository.php#L29) {#690}
  }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions