Changes between Version 5 and Version 6 of faq/gitification

May 25, 2012, 7:07:53 PM (10 years ago)

Install a Drupal module with git


  • faq/gitification

    v5 v6  
    1111We create a new directory, initialise git, tell git which name and email to use, create a temporary file which we commit, delete and commit again to create a master branch:
    1413mkdir liu_d6
    48 We copy our settings.php to our repository directory, create a symbolic link from inside the core and delete the default.settings.php
     47We copy our settings.php to our repository directory, create a symbolic link from inside the core and delete the default.settings.php:
    5049cp ~/settings.php .
    5958There are some more modifications to do but they are really linksunten specific (like applying the two core patches via {{{git am}}} which have been created via {{{git format-patch}}} before) so we leave them out.
     60== Drupal modules ==
     62Normally, Drupal modules are installed under sites/default/modules. This would be fine with our approach but it would create unnecessary huge merges when updating the core and it keeping all parts separately accessible from the root directory of our installation is much clearer arranged. So we create a modules (and perhaps also a files, libraries and themes) directory and a symbolic link to it:
     64mkdir modules
     65cd core/sites/default
     66ln -s ../../../modules
     67cd ../../../
     70Now we install a module in it. As an example we chose the [ i18n] module. At the Drupal project page we click on the green "Version Control" tab and chose "Version to work from: 6.x-1.x". There we get the URL we need to add the project as a remote.
     72git remote add i18n-6.x-1.x 6.x-1.x
     73git fetch
     76Now we do not install the latest version 6.x-1.10 but version 6.x-1.9. The reason is that we have patched that version and we want to use git-subtree and [ git-rebase] to reapply our patches to the newest version. First, we install 6.x-1.9:
     78git subtree add --squash --prefix="modules/i18n" 6.x-1.9
     81Then we overwrite the newly imported files with our patched version and commit the patches. At this point, [ interactive staging] might be a good idea.
     83cp ~/i18n.module modules/i18n
     84cp ~/i18nsync.module modules/i18n
     85git add modules/i18n/
     86git commit -m "i18n: Exchange title with nid in translation box."
     87git add modules/i18n/i18nsync/i18nsync.module
     88git commit -m "i18n: Inherit path when syncing."
     91As our core directory is not empty, we can add the symbolic link to our modules directory:
     93git add core/sites/default/modules
     94git commit -m "Add symbolic link to modules directory."
     97== Update a patched module ==