Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use .git/info/exclude instead of multiple .gitignore #108

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions buddypressorg.test/provision/vvv-init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,13 @@ 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
**/logs
**/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"
Expand Down
12 changes: 4 additions & 8 deletions helper-functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
11 changes: 6 additions & 5 deletions jobs.wordpressnet.test/provision/vvv-init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,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/si-contact-form
/wp-config.php
**/logs
**/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"
Expand Down
11 changes: 6 additions & 5 deletions wordcamp.test/provision/vvv-init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,14 @@ 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
**/logs
**/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"
Expand Down
31 changes: 14 additions & 17 deletions wordpressorg.test/provision/vvv-init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -98,24 +99,20 @@ 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
**/logs
**/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"
Expand Down
9 changes: 5 additions & 4 deletions wordpresstv.test/provision/vvv-init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,13 @@ 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
**/logs
**/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"
Expand Down