composer/composer — pull request #812 by Seldaek (2012-06-20 10:18:04+00:00)
Title: Recover to an older commit if a locked reference is not found

This is meant to solve the problem of people force-pushing into repos, that usually deletes a few commit hashes (that got rewritten, or outright deleted). Basically it stores the commit timestamp together with the reference now.

That way it can try to find a commit by date and if we're lucky we get the same commit (new hash) or if the commit is gone we'll get the previous commit.

It first looks in the current branch and then looks in all commits.

Example output (update of existing install to a new broken lock, and install of a new package with a broken lock):

```
$ c install -v
Installing dependencies from lock file
Updating symfony/console (dev-master afc5ec) to symfony/console (dev-master afc5ec)
- Updating symfony/console (dev-master)
Checking out afc5ecf2967bf3510363535c0389ddc0f6284782
afc5ecf2967bf3510363535c0389ddc0f6284782 is gone (history was rewritten?), recovered by checking out 05a52987acf3a75d4622b7c259bda8a5f0136e9d

$ rm -rf vendor/symfony/console/
$ php composer.phar install
Installing dependencies from lock file
- Installing symfony/console (dev-master)
Cloning afc5ecf2967bf3510363535c0389ddc0f6284782
afc5ecf2967bf3510363535c0389ddc0f6284782 is gone (history was rewritten?), recovered by checking out 05a52987acf3a75d4622b7c259bda8a5f0136e9d
```