Skip to content

Install/archive: improve error message if commit was deleted #10484

@glaubinix

Description

@glaubinix

It happens that commits get removed from VCS repositories, e.g. force push, maintainers delete and recreate tags, resulting in the error output below

composer install
Installing dependencies from lock file (including require-dev)
Verifying lock file contents can be installed on current platform.
Package operations: 1 install, 0 updates, 0 removals
  - Downloading psr/log (3.0.0)
    Failed to download psr/log from dist: The "https://codeload.github.com/php-fig/log/legacy.zip/fe5ea303b0887d5caefd3d431c3e61ad47037002" file could not be downloaded (HTTP/2 404 )
    Now trying to download from source
  - Syncing psr/log (3.0.0) into cache
  - Installing psr/log (3.0.0): Cloning fe5ea303b0
    fe5ea303b0887d5caefd3d431c3e61ad47037002 is gone (history was rewritten?)
    Install of psr/log failed


  [RuntimeException]
  Failed to execute git checkout 'fe5ea303b0887d5caefd3d431c3e61ad47037002' -- && git reset --hard 'fe5ea303b0887d5caefd3d431c3e61ad
  47037002' --

  fatal: reference is not a tree: fe5ea303b0887d5caefd3d431c3e61ad47037002

This already says that the issue might be that the history was rewritten and the commit was not found in the repository. For users, it could be helpful to have a hint at how they can resolve the issue in their project. Maybe something like below?

Looks like the commit hash is not available in the repository, maybe (the tag got recreated|the comit was removed from the branch)? Run composer update package/name to resolve this```

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions