Skip to content

Fatal bug: Avoid unintentional conversion of commit hash into a boolean  #207

Closed
@codebymikey

Description

@codebymikey

#192 introduces a breaking change in calls like $file->getOldBlob()->getContent();, and the following exception is thrown:

In Repository.php line 563:

  [Gitonomy\Git\Exception\ProcessException]
  Error while running git command:
  'git' '--git-dir' '/app/application/.git' '--work-tree' '/app/application/redacted' 'cat-file' '-p' '1'

  fatal: Not a valid object name 1

And as originally noted by @stof in the upstream PR, this is because it unintentionally converts all commit hashes into a boolean (which is then converted into a 1):

Proof of concept: https://3v4l.org/tiJvR

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