From 406911dfcad236a547df116fb8f8f21df095c943 Mon Sep 17 00:00:00 2001 From: Tormi Tabor Date: Fri, 14 Aug 2026 10:27:22 +0300 Subject: [PATCH] fix(GH-177): ensure symlink-project adds /vendor/ and /web/ to gitignore --- commands/web/symlink-project | 8 ++++++++ tests/full.bats | 10 ++++++++++ 2 files changed, 18 insertions(+) diff --git a/commands/web/symlink-project b/commands/web/symlink-project index 4866c8c..faa42c8 100755 --- a/commands/web/symlink-project +++ b/commands/web/symlink-project @@ -25,3 +25,11 @@ fi export DRUPAL_PROJECT_FOLDER=${DDEV_DOCROOT}/${DRUPAL_PROJECTS_PATH}/${DDEV_SITENAME//-/_} php symlink_project.php rm -f symlink_project.php + +# Ensure generated Drupal scaffold paths are ignored in contrib repositories. +touch .gitignore +for pattern in "/vendor/" "/web/"; do + if ! grep -Fxq "$pattern" .gitignore; then + printf "%s\n" "$pattern" >> .gitignore + fi +done diff --git a/tests/full.bats b/tests/full.bats index 0d962a0..68789a9 100644 --- a/tests/full.bats +++ b/tests/full.bats @@ -30,6 +30,16 @@ teardown_file() { ls -la web/modules/custom/test_drupal_contrib/test_drupal_contrib.info.yml } +@test "ddev symlink-project updates gitignore" { + touch .gitignore + run -0 ddev symlink-project + run -0 ddev symlink-project + run -0 grep -Fx "/vendor/" .gitignore + run -0 grep -Fx "/web/" .gitignore + run -0 sh -c '[ "$(grep -c -Fx "/vendor/" .gitignore)" -eq 1 ]' + run -0 sh -c '[ "$(grep -c -Fx "/web/" .gitignore)" -eq 1 ]' +} + @test "php tools availability" { ddev phpcs --version ddev phpstan --version