From 858b785f16210a610b96e4226a44b721341bbeb1 Mon Sep 17 00:00:00 2001 From: Ulrich Pogson Date: Sun, 19 Nov 2017 21:42:38 +0100 Subject: [PATCH 1/2] .git/info/exclude instead of multiple .gitignore #107 --- buddypressorg.test/provision/vvv-init.sh | 8 +++--- helper-functions.sh | 12 +++----- jobs.wordpressnet.test/provision/vvv-init.sh | 10 +++---- wordcamp.test/provision/vvv-init.sh | 10 +++---- wordpressorg.test/provision/vvv-init.sh | 30 +++++++++----------- wordpresstv.test/provision/vvv-init.sh | 8 +++--- 6 files changed, 35 insertions(+), 43 deletions(-) diff --git a/buddypressorg.test/provision/vvv-init.sh b/buddypressorg.test/provision/vvv-init.sh index 424ae2f46..a174e4fd1 100644 --- a/buddypressorg.test/provision/vvv-init.sh +++ b/buddypressorg.test/provision/vvv-init.sh @@ -46,12 +46,12 @@ if [ ! -L $SITE_DIR ]; then # Ignore external dependencies and Meta Environment tweaks IGNORED_FILES=( - /wordpress - /wp-content/mu-plugins/sandbox-functionality.php - /wp-config.php + **/wordpress + **/wp-content/mu-plugins/sandbox-functionality.php + **/wp-config.php ) IGNORED_FILES=( "${IGNORED_FILES[@]}" "${SVN_PLUGINS[@]}" "${WPCLI_PLUGINS[@]}" ) - wme_create_gitignore $SITE_DIR + wme_create_git_exclude "$BASE_DIR/meta-repository" else printf "\n#\n# Updating $SITE_DOMAIN\n#\n" diff --git a/helper-functions.sh b/helper-functions.sh index 1b3e0e227..0234404bc 100644 --- a/helper-functions.sh +++ b/helper-functions.sh @@ -47,19 +47,15 @@ function wme_symlink_logs_dir { mkdir -p $LOGS_DIR_PATH } -# Add entries to a .gitignore file -# -# todo use .git/info/exclude instead, that's more appropriate for this situation +# Add entries to the .git/info/exclude file # # $1 - the site's web root -function wme_create_gitignore { - # Ignore the .gitignore file itself - echo "/.gitignore" >> $1/.gitignore - +function wme_create_git_exclude { for i in "${IGNORED_FILES[@]}" do : - echo "$i" >> $1/.gitignore + echo "$i" >> $1/.git/info/exclude done + awk '!a[$0]++' $1/.git/info/exclude > exclude && mv exclude $1/.git/info/exclude } # Download the global WordPress.org header into the given directory. diff --git a/jobs.wordpressnet.test/provision/vvv-init.sh b/jobs.wordpressnet.test/provision/vvv-init.sh index b47d0022f..af963fa85 100644 --- a/jobs.wordpressnet.test/provision/vvv-init.sh +++ b/jobs.wordpressnet.test/provision/vvv-init.sh @@ -37,12 +37,12 @@ if [ ! -L $SITE_DIR ]; then # Ignore external dependencies and Meta Environment tweaks IGNORED_FILES=( - /wordpress - /wp-content/mu-plugins/sandbox-functionality.php - /wp-content/plugins/si-contact-form - /wp-config.php + **/wordpress + **/wp-content/mu-plugins/sandbox-functionality.php + **/wp-content/plugins/si-contact-form + **/wp-config.php ) - wme_create_gitignore $SITE_DIR + wme_create_git_exclude "$BASE_DIR/meta-repository" else printf "\n#\n# Updating $SITE_DOMAIN\n#\n" diff --git a/wordcamp.test/provision/vvv-init.sh b/wordcamp.test/provision/vvv-init.sh index 0226a6fc4..8d18ea3e4 100644 --- a/wordcamp.test/provision/vvv-init.sh +++ b/wordcamp.test/provision/vvv-init.sh @@ -61,13 +61,13 @@ if [ ! -L $SITE_DIR ]; then # Ignore external dependencies and Meta Environment tweaks IGNORED_FILES=( - /wordpress - /wp-content/mu-plugins/sandbox-functionality.php - /wp-content/plugins/camptix - /wp-config.php + **/wordpress + **/wp-content/mu-plugins/sandbox-functionality.php + **/wp-content/plugins/camptix + **/wp-config.php ) IGNORED_FILES=( "${IGNORED_FILES[@]}" "${SVN_PLUGINS[@]}" "${WPCLI_PLUGINS[@]}" "${WPCLI_THEMES[@]}" ) - wme_create_gitignore $SITE_DIR + wme_create_git_exclude "$BASE_DIR/meta-repository" else printf "\n#\n# Updating $SITE_DOMAIN\n#\n" diff --git a/wordpressorg.test/provision/vvv-init.sh b/wordpressorg.test/provision/vvv-init.sh index 347f690ce..7cf7ed0b3 100644 --- a/wordpressorg.test/provision/vvv-init.sh +++ b/wordpressorg.test/provision/vvv-init.sh @@ -15,6 +15,7 @@ PROVISION_DIR="$BASE_DIR/$SITE_DOMAIN/provision" SITE_DIR="$BASE_DIR/$SITE_DOMAIN/public_html" SVN_PLUGINS=( akismet bbpress debug-bar debug-bar-cron email-post-changes speakerdeck-embed supportflow syntaxhighlighter two-factor wordpress-importer ) WPCLI_PLUGINS=( jetpack tinymce-code-element wp-multibyte-patch ) +THEMES=( twenty* rosetta p2 ) WP_LOCALES=( ja es_ES ) wme_svn_git_migration $SITE_DIR @@ -98,24 +99,19 @@ if [ ! -L $SITE_DIR ]; then # Ignore external dependencies and Meta Environment tweaks IGNORED_FILES=( - /wordpress - /wp-content/languages - /wp-content/mu-plugins/cavalcade* - /wp-content/mu-plugins/global_wordpressorg_dev - /wp-content/mu-plugins/sandbox-functionality.php - /wp-content/plugins/phpdoc-parser - /wp-content/plugins/glotpress - /wp-content/themes/p2 - /wp-content/themes/rosetta - /wp-content/themes/twenty* - /wp-content/sunrise.php - /footer.php - /header.php - /wp-config.php - /wp-cli.yml + **/wordpress + **/wp-content/languages + **/wp-content/mu-plugins/cavalcade* + **/wp-content/mu-plugins/global_wordpressorg_dev + **/wp-content/mu-plugins/sandbox-functionality.php + **/wp-content/sunrise.php + wordpress.org/footer.php + wordpress.org/header.php + **/wp-config.php + **/wp-cli.yml ) - IGNORED_FILES=( "${IGNORED_FILES[@]}" "${SVN_PLUGINS[@]}" "${WPCLI_PLUGINS[@]}" ) - wme_create_gitignore $SITE_DIR + IGNORED_FILES=( "${IGNORED_FILES[@]}" "${SVN_PLUGINS[@]}" "${GIT_PLUGINS[@]}" "${WPCLI_PLUGINS[@]}" "${THEMES[@]}" ) + wme_create_git_exclude "$BASE_DIR/meta-repository" else printf "\n#\n# Updating $SITE_DOMAIN\n#\n" diff --git a/wordpresstv.test/provision/vvv-init.sh b/wordpresstv.test/provision/vvv-init.sh index f9b874263..d68de24d4 100644 --- a/wordpresstv.test/provision/vvv-init.sh +++ b/wordpresstv.test/provision/vvv-init.sh @@ -38,12 +38,12 @@ if [ ! -L $SITE_DIR ]; then # Ignore external dependencies and Meta Environment tweaks IGNORED_FILES=( - /wordpress - /wp-content/mu-plugins/sandbox-functionality.php - /wp-config.php + **/wordpress + **/wp-content/mu-plugins/sandbox-functionality.php + **/wp-config.php ) IGNORED_FILES=( "${IGNORED_FILES[@]}" "${WPCLI_PLUGINS[@]}" ) - wme_create_gitignore $SITE_DIR + wme_create_git_exclude "$BASE_DIR/meta-repository" else printf "\n#\n# Updating $SITE_DOMAIN\n#\n" From 293e9406fd1a092eca9ff7892917444303971d73 Mon Sep 17 00:00:00 2001 From: Ulrich Pogson Date: Sun, 19 Nov 2017 21:46:03 +0100 Subject: [PATCH 2/2] Git ignore log directories introduced in #105 Commit: 3f64897013c6d2b15fccf5f39988f49fb972c0c9 --- buddypressorg.test/provision/vvv-init.sh | 1 + jobs.wordpressnet.test/provision/vvv-init.sh | 1 + wordcamp.test/provision/vvv-init.sh | 1 + wordpressorg.test/provision/vvv-init.sh | 1 + wordpresstv.test/provision/vvv-init.sh | 1 + 5 files changed, 5 insertions(+) diff --git a/buddypressorg.test/provision/vvv-init.sh b/buddypressorg.test/provision/vvv-init.sh index a174e4fd1..33bc996d5 100644 --- a/buddypressorg.test/provision/vvv-init.sh +++ b/buddypressorg.test/provision/vvv-init.sh @@ -46,6 +46,7 @@ if [ ! -L $SITE_DIR ]; then # Ignore external dependencies and Meta Environment tweaks IGNORED_FILES=( + **/logs **/wordpress **/wp-content/mu-plugins/sandbox-functionality.php **/wp-config.php diff --git a/jobs.wordpressnet.test/provision/vvv-init.sh b/jobs.wordpressnet.test/provision/vvv-init.sh index af963fa85..0ff63a3b3 100644 --- a/jobs.wordpressnet.test/provision/vvv-init.sh +++ b/jobs.wordpressnet.test/provision/vvv-init.sh @@ -37,6 +37,7 @@ if [ ! -L $SITE_DIR ]; then # Ignore external dependencies and Meta Environment tweaks IGNORED_FILES=( + **/logs **/wordpress **/wp-content/mu-plugins/sandbox-functionality.php **/wp-content/plugins/si-contact-form diff --git a/wordcamp.test/provision/vvv-init.sh b/wordcamp.test/provision/vvv-init.sh index 8d18ea3e4..f5a92f413 100644 --- a/wordcamp.test/provision/vvv-init.sh +++ b/wordcamp.test/provision/vvv-init.sh @@ -61,6 +61,7 @@ if [ ! -L $SITE_DIR ]; then # Ignore external dependencies and Meta Environment tweaks IGNORED_FILES=( + **/logs **/wordpress **/wp-content/mu-plugins/sandbox-functionality.php **/wp-content/plugins/camptix diff --git a/wordpressorg.test/provision/vvv-init.sh b/wordpressorg.test/provision/vvv-init.sh index 7cf7ed0b3..be8f44390 100644 --- a/wordpressorg.test/provision/vvv-init.sh +++ b/wordpressorg.test/provision/vvv-init.sh @@ -99,6 +99,7 @@ if [ ! -L $SITE_DIR ]; then # Ignore external dependencies and Meta Environment tweaks IGNORED_FILES=( + **/logs **/wordpress **/wp-content/languages **/wp-content/mu-plugins/cavalcade* diff --git a/wordpresstv.test/provision/vvv-init.sh b/wordpresstv.test/provision/vvv-init.sh index d68de24d4..87593cedb 100644 --- a/wordpresstv.test/provision/vvv-init.sh +++ b/wordpresstv.test/provision/vvv-init.sh @@ -38,6 +38,7 @@ if [ ! -L $SITE_DIR ]; then # Ignore external dependencies and Meta Environment tweaks IGNORED_FILES=( + **/logs **/wordpress **/wp-content/mu-plugins/sandbox-functionality.php **/wp-config.php