Changes between Version 17 and Version 18 of faq/gitification


Ignore:
Timestamp:
May 27, 2012, 10:13:15 PM (7 years ago)
Author:
Bart
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • faq/gitification

    v17 v18  
    7272Now 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 which we need to add the repository as a remote repository. The parameter -f triggers an instant fetch:
    7373{{{
    74 git remote add -f i18n-6.x-1.x http://git.drupal.org/project/i18n.git 6.x-1.x
     74git remote add -f i18n-6.x-1.x git://git.drupal.org/project/i18n.git 6.x-1.x
    7575}}}
    7676
     
    230230Version 1.x of git_deploy was based on [https://github.com/patrikf/glip glip], a Git Library In PHP. Version 2.x of git_deploy calls the git executable directly and parses the output instead. There might be issues in a shared hosting environment but many people report that the 2.x version works far better than the 1.x version, so we'll adapt git_deploy 2.x to git-subtree.
    231231
    232 Let's analyse what git_deplploy does. The module implements only one hook: [http://api.drupal.org/api/drupal/developer!hooks!core.php/function/hook_system_info_alter/6 hook_system_info_alter]. With this hook the module info obtained through git can be induced. But the module searches for a ''.git'' directory, so it only works for git-submodules in the current version:
     232Let's analyse what git_deplploy does. The module implements only one hook: [http://api.drupal.org/api/drupal/developer!hooks!core.php/function/hook_system_info_alter/6 hook_system_info_alter]. With this hook the module info obtained through git can be induced. But the module searches for a ''.git'' directory, so it only works for git-submodules in the current version.
    233233{{{
    234234      while ($directory && !is_dir("$directory/.git")) {
     
    237237}}}
    238238
     239It uses the Fetch URL obtained by {{{git remote show -n origin}}} to determine the project name. This won't work with git-subtree as remotes are usually not exported so a clone won't know the original fetch urls used for {{{git subtree add}}}. Fortunaltely, drupal.org uses well-defined fetch urls so we can reconstruct the information. But the process will be much more time-consuming with git-subtree than it is with git-submodule.
     240{{{
     241        exec("$git remote show -n origin 2>&1", $output);
     242        if ($fetch_url = preg_grep('/^\s*Fetch URL:/', $output)) {
     243          $fetch_url = current($fetch_url);
     244          $project_name = substr($fetch_url, strrpos($fetch_url, '/') + 1);
     245          if (substr($project_name, -4) == '.git') {
     246            $project_name = substr($project_name, 0, -4);
     247          }
     248          $info['project'] = $project_name;
     249        }
     250}}}