I find that git_deploy doesn't work on companion modules that are in subdirectories of the project directory, such as in views/modules or cck/modules. And related, git_deploy causes major problems if I clone Drupal core straight from the repository.
Here is a possible fix, although I'm not sure it's ideal. It simply climbs the directory tree from the module/theme directory until it finds a .git directory. Encountering the "sites" directory will cause it to abort, so that it doesn't confuse Drupal core with contributed modules. A smarter way would be to check the .git directory to see if the the module/theme files has been added to the repository there.
[therzog@srv820 git_deploy]$ git diff 6.x-1.x
diff --git a/git_deploy.module b/git_deploy.module
index 4c93690..784350d 100644
--- a/git_deploy.module
+++ b/git_deploy.module
@@ -30,8 +30,6 @@
* Ignored. D7 has this, D6 doesn't. Is set to either 'module' or 'theme'.
*/
function git_deploy_system_info_alter(&$info, $file) {
- $module_dir = dirname($file->filename);
- $git_dir = $module_dir . DIRECTORY_SEPARATOR . '.git';
// Skip this item if version and project are already set.
if (!empty($info['version'])
@@ -40,7 +38,7 @@ function git_deploy_system_info_alter(&$info, $file) {
}
// Skip this item if it has no .git directory
- if (!file_exists($git_dir)) {
+ if( ! ($git_dir = git_deploy_get_repository(dirname($file->filename))) ) {
return;
}
@@ -73,6 +71,30 @@ function git_deploy_system_info_alter(&$info, $file) {
}
}
+function git_deploy_get_repository($path) {
+
+ $name = DIRECTORY_SEPARATOR . '.git';
+
+ while( $path ) {
+ if( $path == 'sites' ) {
+ /* Prevent site-specific files and contributed themes/modules/libs from inheriting version information from Drupal core.
+ This assumes that all non-core elements are installed in /sites and not /modules or /themes
+ */
+ return;
+ }
+
+ if( file_exists($path . $name) ) {
+ return $path . $name;
+ }
+
+ $path = dirname($path);
+ }
+
+ if( file_exists('.' . $name) ) {
+ return '.' . $name;
+ }
+}
+
Comments
Comment #1
darrell_ulm commentedHi, I may have an issue related to:
Can you let me know what are the major problems?
Thank you.
Comment #2
darren oh