Skip to content

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

@elbroto

Description

@elbroto

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:

{
    "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

{
      "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 about this. So this is not a valid solution :(

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions