Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot use path repository with VCS branch #8498

Closed
danepowell opened this issue Dec 26, 2019 · 5 comments
Closed

Cannot use path repository with VCS branch #8498

danepowell opened this issue Dec 26, 2019 · 5 comments
Labels
Bug
Milestone

Comments

@danepowell
Copy link
Contributor

@danepowell danepowell commented Dec 26, 2019

I think there's a bug with how Composer determines the checked out version of a local VCS repo (when attempting to link it via a path repository).

To reproduce, clone Acquia Connector to /Users/dane/packages/acquia_connector (or adjust the path for your system obviously), and check out a new branch ancillary-branch from 8.x-2.x.

Then in a new directory, use composer.json:

{
    "license": "proprietary",
    "repositories": {
        "ancillary": {
            "type": "path",
            "url": "/Users/dane/packages/acquia_connector",
            "options": {
                "symlink": false
            }
        }
    },
    "minimum-stability": "dev"
}

Output of composer diagnose:

Checking composer.json: OK
Checking platform settings: OK
Checking git settings: OK
Checking http connectivity to packagist: OK
Checking https connectivity to packagist: OK
Checking github.com oauth access: OK
Checking disk free space: OK
Checking pubkeys:
Tags Public Key Fingerprint: 57815BA2 7E54DC31 7ECC7CC5 573090D0  87719BA6 8F3BB723 4E5D42D0 84A14642
Dev Public Key Fingerprint: 4AC45767 E5EC2265 2F0C1167 CBBB8A2B  0C708369 153E328C AD90147D AFE50952
OK
Checking composer version: OK
Composer version: 1.9.1
PHP version: 7.4.1
PHP binary path: /usr/local/Cellar/php/7.4.1/bin/php

When I run this command:

composer require drupal/acquia_connector:dev-ancillary-branch

I get the following output:

[InvalidArgumentException]
Could not find package drupal/acquia_connector in a version matching dev-ancillary-branch

And I expected this to happen:
Local package version ancillary-branch of drupal/acquia_connector to be checked out.

You can also see this bug happening in the drupal.org testbot, which is what led me here: https://www.drupal.org/project/drupalci_testbot/issues/3102874

Interestingly, if I instead composer require drupal/acquia_connector:'*', I get the 8.x-2.x branch from the local repo. So it seems that composer is interpreting the local version as 8.x-2.x even though ancillary-branch is checked out.

@Seldaek

This comment has been minimized.

Copy link
Member

@Seldaek Seldaek commented Jan 13, 2020

This is actually a feature, in which if you are on a feature branch it detects which branch it came from and assumes that is the version of the package. This helps in cases where other packages might be requiring the dev-master branch (or 8.x-2.x in this case). They are not aware of your feature branch so we alias it automatically.. Except if you require explicitly the feature branch then indeed things fail.

Not sure if we can fix this, maybe there is a way we return two packages with the two versions.. I need to investigate further.

@danepowell

This comment has been minimized.

Copy link
Contributor Author

@danepowell danepowell commented Jan 13, 2020

Ah yeah that makes sense. I agree that supporting the base Branch as it does now is a great feature, but I think it should also support the actual feature branch name. The current behavior, while helpful, is unintuitive.

@Seldaek

This comment has been minimized.

Copy link
Member

@Seldaek Seldaek commented Jan 14, 2020

Alright would be glad if you can try with latest snapshot (composer self-update --snapshot) see if it fixes it for you, but according to my repro case it works.

@Seldaek Seldaek added this to the 1.9 milestone Jan 14, 2020
@Seldaek Seldaek added the Bug label Jan 14, 2020
@danepowell

This comment has been minimized.

Copy link
Contributor Author

@danepowell danepowell commented Jan 14, 2020

Awesome, I just tested it and it worked great! Thanks so much for the quick work!

@Seldaek

This comment has been minimized.

Copy link
Member

@Seldaek Seldaek commented Jan 14, 2020

Ok, it's part of the 1.9.2 release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.