Skip to content

Check for local changes when switching a package from source to dist#12912

Merged
Seldaek merged 1 commit into
composer:mainfrom
eyupcanakman:fix/check-changes-before-source-removal
Jun 3, 2026
Merged

Check for local changes when switching a package from source to dist#12912
Seldaek merged 1 commit into
composer:mainfrom
eyupcanakman:fix/check-changes-before-source-removal

Conversation

@eyupcanakman
Copy link
Copy Markdown
Contributor

A composer update that switches a package from a source install to a dist install wiped the whole directory, including its .git and any local commits, because the removal skipped the local-changes check that a same-source update runs. The source downloader's uninstall guard now runs first on a type change, so the switch aborts on uncommitted or unpushed work instead of deleting it.

Fixes #11567

On a source to dist switch DownloadManager::update removed the install without the local-changes guard a same-source update runs, wiping the checkout's .git and any local commits. The source downloader's uninstall guard now runs first on a type change so the switch aborts on uncommitted or unpushed work.

Fixes composer#11567
@Seldaek Seldaek added this to the 2.10 milestone Jun 3, 2026
@Seldaek Seldaek merged commit 7f7e62b into composer:main Jun 3, 2026
21 of 22 checks passed
@Seldaek
Copy link
Copy Markdown
Member

Seldaek commented Jun 3, 2026

Cool, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Composer install/update removes .git folder in vendor libraries

2 participants