我主要使用 composer 来管理 git 存储库(本地和远程)。Composer 读取所有历史提交中 composer.json 的每个标记实例:
Reading composer.json of tomekwi/composer-installers (v1.0.0)
Importing tag v1.0.0 (1.0.0.0)
Reading composer.json of tomekwi/composer-installers (v1.0.1)
Importing tag v1.0.1 (1.0.1.0)
Reading composer.json of tomekwi/composer-installers (v1.0.2)
Importing tag v1.0.2 (1.0.2.0)
Reading composer.json of tomekwi/composer-installers (v1.0.3)
Importing tag v1.0.3 (1.0.3.0)
Reading composer.json of tomekwi/composer-installers (v1.0.4)
Importing tag v1.0.4 (1.0.4.0)
Reading composer.json of tomekwi/composer-installers (v1.0.5)
Importing tag v1.0.5 (1.0.5.0)
Reading composer.json of tomekwi/composer-installers (v1.0.6)
Importing tag v1.0.6 (1.0.6.0)
Reading composer.json of tomekwi/composer-installers (1.x)
Importing branch 1.x (1.x-dev)
...etc
较大的存储库需要很长时间。另外,它会导致 github 出现问题(https://circleci.com/docs/composer-api-rate-limit)
如果我理解正确,这样做的目的是从每个 composer.json 文件中提取版本号。如果 composer 通过读取标签名称来选择正确的版本会快很多。请求"tomekwi/composer-installers": "~1.0"
可能如下所示:
Reading tags of tomekwi/composer-installers
- Picked matching tag (v1.0.6)
Reading composer.json of tomekwi/composer-installers (v1.0.6)
- Installing tomekwi/composer-installers (v1.0.6)
..并花半秒钟而不是半分钟。
有可能这样做吗?