composer / composer/satis

Different composer module name in different branch, but name from master branch is used

Open
#968 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
PHP
Stars
3.3k
Forks
530
Avg merge
6h 53m
Merged PRs (30d)
13

Description

I recently updated a few php modules. Inside the composer.json the name changed from "oldvendor/my-module" to "newvendor/someprefix-my-module". This change is committed into a different branch "better-version", not master.

This is what my repo.json looks like:
```json
{
"name": "MyRepository",
"repositories": [
{ "type": "git", "url": "git@localhost:module/my-module.git" },
],
"require-all": true,
"require-dependencies": false,
"require-dev-dependencies": false,
"archive": {
"directory": "dist",
"format": "zip",
"skip-dev": false
}
}
````

Running `php bin/satis build repo.json public/` recognises both my branches, but puts out two files named `public/dist/oldvendor/my-module-dev-master-4aee4c.zip` and `public/dist/oldvendor/my-module-dev-better-version-5a555c.zip`.
So in my composer.json requiring the module from better-version does only work with its old name:
works: `"oldvendor/my-module": "dev-better-version"`
doesnt: `"newvendor/someprefix-my-module": "dev-better-version"`

When I delete master, satis seems to recognise "better-version" as the new main branch and the file is output correctly to `public/dist/newvendor/someprefix-my-module-dev-better-version-5a555c.zip`

What am I missing here? Can this be solved without having two separate repositories?

(Changing the name might be bad practice ...but since these are private modules I dont want to spak that discussion)

Edit: It somehow works by using
```json
{
"type": "package",
"package": {
"name": "newvendor/someprefix-my-module",
"version": "dev-better-version",
"source": {
"url": "git@localhost:module/my-module.git",
"type": "git",
"reference": "better-version"
}
}
}
```
However reference does not track changes in the branch. The composer [doc warns](https://getcomposer.org/doc/05-repositories.md#package-2) about this. So this is not a valid solution :(

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue with the shown repo.json and composer.json files by running php bin/satis build repo.json public/ against both branches. Compare how Satis selects package metadata and archive paths for master and better-version; done means each branch uses its own Composer name without a manual package definition, while continuing to track branch changes.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.