Skip to content

feat: add locally-tracked guard to install and update methods in Inst…#17

Merged
roble merged 1 commit into
mainfrom
dev
Jun 6, 2026
Merged

feat: add locally-tracked guard to install and update methods in Inst…#17
roble merged 1 commit into
mainfrom
dev

Conversation

@roble

@roble roble commented Jun 6, 2026

Copy link
Copy Markdown
Collaborator

This pull request introduces logic to skip installation and updating of modules that are locally tracked (i.e., have a .git directory), preventing Composer from overwriting local changes. Comprehensive tests are also added to ensure this behavior.

Installer logic improvements

  • src/Installer.php: The install and update methods now detect if a module is locally tracked (by checking for a .git directory) and skip installation or update for such modules, logging a message to the user and ensuring repository state is consistent. [1] [2]

Test coverage

  • tests/ModuleInstallerTest.php: Added test_install_skips_when_install_path_is_locally_tracked to verify that installation is skipped for locally tracked modules and the correct message is output.
  • tests/ModuleInstallerTest.php: Added test_update_skips_when_install_path_is_locally_tracked to verify that updates are skipped for locally tracked modules, the repository is updated appropriately, and the correct message is output.

Copilot AI review requested due to automatic review settings June 6, 2026 12:34
@roble roble merged commit ba04b9e into main Jun 6, 2026
3 checks passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a “locally tracked” safeguard to the module installer so that modules with an existing .git directory are not overwritten during install() or update(), while still keeping Composer’s installed-repository state consistent. It also adds PHPUnit coverage to verify the skip behavior and messaging.

Changes:

  • Add a locally-tracked guard to Installer::install() that skips installation when the install path is locally tracked and ensures the package is registered in the installed repo.
  • Add a locally-tracked guard to Installer::update() that skips updating when the install path is locally tracked, while replacing the repo entry from $initial to $target.
  • Add tests covering the install/update skip behavior for .git-present install paths.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/Installer.php Adds locally-tracked early-return guards to install() and update() and adjusts repo bookkeeping when skipping.
tests/ModuleInstallerTest.php Adds tests validating that install/update are skipped for locally tracked install paths and the expected messages/repo updates occur.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/Installer.php
return \React\Promise\resolve(null);
}

if ($this->isLocallyTracked($this->getInstallPath($package))) {
Comment thread src/Installer.php

$installPath = $this->getInstallPath($target);

if ($this->isLocallyTracked($installPath)) {
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.

2 participants