I would like to have drush build directly from a local git repository rather than downloading. This enables multiple developers to work with the same local copy rather than everyone downloading their own every time.

I have a single linux user, 'drupal' (configurable) which owns copies of the repositories. The script always
runs 'sudo -u drupal' to clone and fetch.

I also maintain a single local server, which runs 'git clone' and 'git fetch -t' against drupal.org and have
all other systems use the local one as a source (running git over ssh rather than http).

I have done this in perl already but I'd like to get it working in drush. Initially, I just need to be able to have drush unpack the code from a local repository. The clone() and fetch() features could be added later.

In perl this looks like (using 'zen' as an example):

$sitedir =  join( '/', $ENV{HOME}, 'mysite' );
$source = '~drupal/bare';
$name = 'zen';
$type = 'theme';
$tag = '7.x-3.1';
$prefix = join('/',$sitedir, qw( sites all ), $type);
$repo = join('/',$source ,$name . '.git');
system("git  --git-dir=$repo  archive  --prefix=$prefix/  $tag  |  tar xf -");

To unpack drupal itself, the $prefix is just $sitedir and everything works the same way.

I have looked at the drush code under commands/make/ but it will take me some time to figure out how to do this by myself so I would welcome some hints.

Comments

gh2012’s picture

Version: » 7.x-5.0
greg.1.anderson’s picture

Version: 7.x-5.0 » 8.x-6.x-dev
Status: Active » Closed (won't fix)
Issue tags: +Needs migration

This issue was marked closed (won't fix) because Drush has moved to Github.

If this feature is still desired, you may copy it to our Github project. For best results, create a Pull Request that has been updated for the master branch. Post a link here to the PR, and please also change the status of this issue to closed (duplicate).

Please ask support questions on Drupal Answers.