Skip to content

Instantly share code, notes, and snippets.

@rfay
Created February 25, 2011 05:59
Show Gist options
  • Save rfay/843423 to your computer and use it in GitHub Desktop.
Save rfay/843423 to your computer and use it in GitHub Desktop.
Create a huge reference repo

This is a repository that has objects for all Drupal projects which are enabled for testing.

The list of projects can be created with:

echo "select uri from project_projects p,pift_project pp where pp.pid = p.nid" | mysql gitdev >/tmp/projects.txt

#!/bin/bash
repo=/var/cache/git/reference_cache
source_base_url=git://git.drupal.org/project
projects="drupal devel image mailhandler poormanscron privatemsg project redirect weather ecommerce captcha nodewords simpletest translation pathauto media comment_notify userpoints taxonews nodequeue porterstemmer g2 vote_up_down google_analytics taxonomy_filter geshifilter opensearch chessboard path_redirect token admin_menu services adminrole potx autoassignrole content_access l10n_server versioncontrol user_delete openlayers rules xmlsitemap css_injector userpoints_contrib talk millennium elements mollom linkchecker piwik storm plugin_manager realname languageicons project_issue_file_review uuid role_change_notify profile_permission userpoints_nc securepages_prevent_hijack search_by_page libraries og_statistics grammar_parser skinr faces nd encrypt password_change entitycache examples blogapi drupal_queue profile2 entity better_exposed_filters clock proxy contact vars simpletest_selenium sshkey multicron errornot fontyourface transformers date_popup_authored smartcrop embeddable edge rtsg field_collection comment_allow_anonymous field_formatter_settings myspace_sync references properties"
# Create a temporary directory and arrange for cleanup on exit.
TEMPDIR=`mktemp -d`
trap "rm -Rf $TEMPDIR" EXIT
if ! test -d $repo; then
mkdir $repo
fi
cd $repo
if ! test -d ".git"; then
git init --bare
git config core.compression 1
fi
# In each project:
# * Clone it
# * Use that clone as a remote in our reference repo
echo Cloning all projects to temp repos
for project in $projects
do
echo "Cloning $project..."
git clone --bare $source_base_url/$project.git $TEMPDIR/$project
git remote add $project $TEMPDIR/$project
done
# Fetch all the new (local) remotes we gathered
git fetch --all
echo "Fixing URLs on all remotes to point to the real repo"
# Now change the remotes to the correct remote URL.
for project in $projects
do
git remote set-url $project $source_base_url/$project.git
done
echo "Re-fetching from the real repo"
# To update, all we need to do is...
git fetch --all
@mattfarina
Copy link

Based on the work by Damien and Randy I created a script to init, add to, and update and Drupal Git Cache. It's available at http://drupal.org/sandbox/mfer/1074256

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment