我有一个库foo/foo-lib
,requires
来自GitHub的特定提交:
{
"name": "foo/foo-lib",
"repositories": [
{
"type": "vcs",
"url": "https://github.com/KnpLabs/Gaufrette.git"
}
],
"require": {
"knplabs/gaufrette": "dev-master#2633721877cae79ad461f3ca06f3f77fb4fce02e"
}
}
它工作正常:
$ composer update
Loading composer repositories with package information
Updating dependencies (including require-dev)
- Updating knplabs/gaufrette dev-master (2633721 => 2633721)
Checking out 2633721877cae79ad461f3ca06f3f77fb4fce02e
Generating autoload files
但是当我在其他项目中需要该库时:
{
"name": "bar/bar-app",
"repositories": [
{
"type": "vcs",
"url": "ssh://git.example.com/foo-lib"
}
],
"require-dev": {
"foo/foo-lib": "dev-master"
}
}
它产生依赖错误:
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for foo/foo-lib dev-master -> satisfiable by foo/foo-lib[dev-master].
- foo/foo-lib dev-master requires knplabs/gaufrette dev-master#2633721877cae79ad461f3ca06f3f77fb4fce02e -> no matching package found.
所以我的问题是:如何正确地require
从库中的GitHub提交特定的提交,以便它可以在依赖包中使用?
3
请注意,当需要提交时,作曲家将不遵守提交要求(cmoposer.json)。取而代之的是,它计算分支头要求,该要求会随着时间而变化。因此,这可能会工作一段时间,但将来肯定会中断。
—
estani 2014年