{"action":"created","issue":{"url":"https://api.github.com/repos/composer/composer/issues/5823","repository_url":"https://api.github.com/repos/composer/composer","labels_url":"https://api.github.com/repos/composer/composer/issues/5823/labels{/name}","comments_url":"https://api.github.com/repos/composer/composer/issues/5823/comments","events_url":"https://api.github.com/repos/composer/composer/issues/5823/events","html_url":"https://github.com/composer/composer/issues/5823","id":185978384,"number":5823,"title":"--prefer-dist doesn't respect commit refs","user":{"login":"danepowell","id":1984514,"avatar_url":"https://avatars.githubusercontent.com/u/1984514?v=3","gravatar_id":"","url":"https://api.github.com/users/danepowell","html_url":"https://github.com/danepowell","followers_url":"https://api.github.com/users/danepowell/followers","following_url":"https://api.github.com/users/danepowell/following{/other_user}","gists_url":"https://api.github.com/users/danepowell/gists{/gist_id}","starred_url":"https://api.github.com/users/danepowell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danepowell/subscriptions","organizations_url":"https://api.github.com/users/danepowell/orgs","repos_url":"https://api.github.com/users/danepowell/repos","events_url":"https://api.github.com/users/danepowell/events{/privacy}","received_events_url":"https://api.github.com/users/danepowell/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-10-28T17:31:44Z","updated_at":"2016-10-31T10:16:50Z","closed_at":"2016-10-31T07:30:46Z","body":"My `composer.json`:\n\n``` json\n{\n  \"minimum-stability\": \"dev\",\n  \"require\": {\n    \"drupal/simplesamlphp_auth\": \"8.3.x-dev#283994f\",\n    \"drupal/acquia_lift\": \"8.3.x-dev#6640cab\"\n  },\n  \"repositories\": [\n    {\n      \"type\": \"composer\",\n      \"url\": \"https://packagist.drupal-composer.org\"\n    }\n  ]\n}\n```\n\nWhen I run these commands:\n\n```\ncomposer update\nrm -rf vendor\ncomposer install --prefer-dist\n```\n\nI get the following output:\n\n```\n- Installing drupal/acquia_lift (dev-8.x-3.x 6640cab)\n    Loading from cache\n- Installing drupal/simplesamlphp_auth (dev-8.x-3.x 283994f)\n    Cloning 283994f from cache\n```\n\nI would expect that both drupal/acquia_lift and drupal/simplesamlphp_auth are cloned from git, since they both specify a commit ref, and the packaged version for acquia_lift is much newer than the specified commit ref.\n\nA couple notes:\n- For simplesamlphp_auth, 283994f actually matches HEAD, and therefore the code in the packaged release. So it seems that the logic for --prefer-dist is actually exactly backwards: it's using the packaged version when it should be cloning from git and vice versa.\n- The behavior is slightly different if a local copy of the package already exists. --prefer-dist is a bit \"sticky\" and will tend to use whatever is already in place, if you already have a source version of a package it will stick to the source version. That's why it's good to remove the vendor directory between tests, as in the testing steps above.\n"},"comment":{"url":"https://api.github.com/repos/composer/composer/issues/comments/257257955","html_url":"https://github.com/composer/composer/issues/5823#issuecomment-257257955","issue_url":"https://api.github.com/repos/composer/composer/issues/5823","id":257257955,"user":{"login":"alcohol","id":21414,"avatar_url":"https://avatars.githubusercontent.com/u/21414?v=3","gravatar_id":"","url":"https://api.github.com/users/alcohol","html_url":"https://github.com/alcohol","followers_url":"https://api.github.com/users/alcohol/followers","following_url":"https://api.github.com/users/alcohol/following{/other_user}","gists_url":"https://api.github.com/users/alcohol/gists{/gist_id}","starred_url":"https://api.github.com/users/alcohol/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alcohol/subscriptions","organizations_url":"https://api.github.com/users/alcohol/orgs","repos_url":"https://api.github.com/users/alcohol/repos","events_url":"https://api.github.com/users/alcohol/events{/privacy}","received_events_url":"https://api.github.com/users/alcohol/received_events","type":"User","site_admin":false},"created_at":"2016-10-31T10:16:50Z","updated_at":"2016-10-31T10:16:50Z","body":"I will happily accept a docs PR for that."}}
{"actor":{"display_login":"alcohol"}}