Skip to content

Adding explicit message to why-not if package is already installed #12231

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

Merged
merged 3 commits into from
Jan 20, 2025

Conversation

ThomasLandauer
Copy link
Contributor

@ThomasLandauer ThomasLandauer commented Dec 10, 2024

Closes #12227

I just did what you told me in #12227 (comment) - don't really have an overview ;-)

return is still missing, right? Should I just copy this from further down?:

$return = $inverted ? 1 : 0;

Or move it upwards?

@Seldaek
Copy link
Member

Seldaek commented Dec 11, 2024

Well I think I'd say return 0; always because it's kinda successful as in there is no reason why-not that package.

@Seldaek
Copy link
Member

Seldaek commented Dec 11, 2024

As for this:

I just did what you told me in #12227 (comment) - don't really have an overview ;-)

Ok but did you try to run the code tho? Does it work and make sense to you? :) Also would need to try the why command to make sure it doesn't bork.

@Seldaek Seldaek added this to the 2.8 milestone Dec 11, 2024
@Seldaek Seldaek added the Bug label Dec 11, 2024
@ThomasLandauer
Copy link
Contributor Author

Ok but did you try to run the code tho?

Ahem, no ;-) You don't have a CONTRIBUTE.md - how can I build it locally?

@Seldaek
Copy link
Member

Seldaek commented Dec 11, 2024

We do but it's in the .github dir https://github.com/composer/composer/blob/main/.github/CONTRIBUTING.md

@ThomasLandauer
Copy link
Contributor Author

ThomasLandauer commented Dec 11, 2024

Wouldn't it be better to move CONTRIBUTING.md to the top directory?

The code looks good -here's what I did:

$ git clone -b patch-1 https://github.com/ThomasLandauer/composer
$ cd composer && php ../composer.phar install
$ bin/composer why-not composer/ca-bundle 1.5.3
# Font in orange color:
Package "composer/ca-bundle" 1.5.3 is already installed! To find out why, run `composer why composer/ca-bundle`
$ bin/composer why composer/ca-bundle
composer/composer 2.8.x-dev requires composer/ca-bundle (^1.5)

I modified the caseWhyNotProvider named 'there is no installed package depending on the package in versions not matching a specific version' (i.e. didn't create a new one). Is that OK?

@Seldaek Seldaek merged commit 34c16ad into composer:main Jan 20, 2025
20 checks passed
@Seldaek
Copy link
Member

Seldaek commented Jan 20, 2025

Alright thanks

@ThomasLandauer ThomasLandauer deleted the patch-1 branch January 20, 2025 13:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Suggestion: composer why-not: Better output if package is already installed
2 participants