diff --git a/composer/Plugin/Scaffold/ManageGitIgnore.php b/composer/Plugin/Scaffold/ManageGitIgnore.php index dcb03fafcb8..524cb2ff605 100644 --- a/composer/Plugin/Scaffold/ManageGitIgnore.php +++ b/composer/Plugin/Scaffold/ManageGitIgnore.php @@ -61,7 +61,7 @@ class ManageGitIgnore { if (!$is_tracked && $scaffoldResult->isManaged()) { $dir = realpath(dirname($path)); $name = basename($path); - $add_to_git_ignore[$dir][] = $name; + $add_to_git_ignore[$dir][] = '/' . $name; } } } diff --git a/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Functional/ManageGitIgnoreTest.php b/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Functional/ManageGitIgnoreTest.php index c73faf74bdf..ea965164b11 100644 --- a/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Functional/ManageGitIgnoreTest.php +++ b/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Functional/ManageGitIgnoreTest.php @@ -112,18 +112,18 @@ class ManageGitIgnoreTest extends TestCase { $this->assertFileExists($sut . '/docroot/autoload.php'); $this->assertFileExists($sut . '/docroot/index.php'); $expected = <<