Changes between Version 5 and Version 6 of faq/gitification


Ignore:
Timestamp:
May 25, 2012, 7:07:53 PM (7 years ago)
Author:
Bart
Comment:

Install a Drupal module with git

Legend:

Unmodified
Added
Removed
Modified
  • faq/gitification

    v5 v6  
    1010
    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:
    12 
    1312{{{
    1413mkdir liu_d6
     
    4645}}}
    4746
    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:
    4948{{{
    5049cp ~/settings.php .
     
    5857
    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.
     59
     60== Drupal modules ==
     61
     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:
     63{{{
     64mkdir modules
     65cd core/sites/default
     66ln -s ../../../modules
     67cd ../../../
     68}}}
     69
     70Now we install a module in it. As an example we chose the [http://drupal.org/project/i18n 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.
     71{{{
     72git remote add i18n-6.x-1.x http://git.drupal.org/project/i18n.git 6.x-1.x
     73git fetch
     74}}}
     75
     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 [http://git-scm.com/book/en/Git-Branching-Rebasing git-rebase] to reapply our patches to the newest version. First, we install 6.x-1.9:
     77{{{
     78git subtree add --squash --prefix="modules/i18n" 6.x-1.9
     79}}}
     80
     81Then we overwrite the newly imported files with our patched version and commit the patches. At this point, [http://git-scm.com/book/ch6-2.html interactive staging] might be a good idea.
     82{{{
     83cp ~/i18n.module modules/i18n
     84cp ~/i18nsync.module modules/i18n
     85git add modules/i18n/i18n.pages.inc
     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."
     89}}}
     90
     91As our core directory is not empty, we can add the symbolic link to our modules directory:
     92{{{
     93git add core/sites/default/modules
     94git commit -m "Add symbolic link to modules directory."
     95}}}
     96
     97== Update a patched module ==
     98