gitonomy/gitlib

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

Closed this issue · 0 comments

#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