61 | | The solution is a bit tricky but is well described at http://kerneltrap.org/mailarchive/git/2007/5/1/245002. The idea is to fetch each external as a separate branch in the Git repository and create submodules, one for each external, by cloning the repository itself, hacking a few files so that they refer to the same as in the main repository and change the branch used for each submodule to the appropriate one. |
62 | | |
| 61 | The solution is a bit tricky but is well described at http://kerneltrap.org/mailarchive/git/2007/5/1/245002. The idea is to fetch each external as a separate branch in the Git repository and create submodules, one for each external, by cloning the repository itself, hacking a few files so that they refer to the same as in the main repository and change the branch used for each submodule to the appropriate one. Typical steps involve: |
| 62 | * Adding the SVN remote branches to be tracked for each tool. This is typically done by adding the following sections to `.git/config` (change the versions to whatever is appropriate): |
| 63 | {{{ |
| 64 | [svn-remote "panc-8.2.11"] |
| 65 | url = https://svn.lal.in2p3.fr/LCG/QWG |
| 66 | fetch = /External/panc-8.2.11:refs/remotes/svn-panc-8.2.11 |
| 67 | [svn-remote "ant-1.7.1"] |
| 68 | url = https://svn.lal.in2p3.fr/LCG/QWG |
| 69 | fetch = /External/apache-ant-1.7.1:refs/remotes/svn-ant-1.7.1 |
| 70 | [svn-remote "saxonb-9.1.0.2J"] |
| 71 | url = https://svn.lal.in2p3.fr/LCG/QWG |
| 72 | fetch = /External/saxonb-9.1.0.2J:refs/remotes/svn-saxonb-9.1. |
| 73 | [svn-remote "scdb-ant-utils-8.0.1"] |
| 74 | url = https://svn.lal.in2p3.fr/LCG/QWG |
| 75 | fetch = /External/scdb-ant-utils-8.0.1:refs/remotes/svn-scdb-ant-utils-8.0.1 |
| 76 | [svn-remote "svnkit-1.3.2"] |
| 77 | url = https://svn.lal.in2p3.fr/LCG/QWG |
| 78 | fetch = /External/svnkit-1.3.2:refs/remotes/svn-svnkit-1.3.2 |
| 79 | }}} |
| 80 | * Fetch each remote branch with the following command used for each `svn-remove` entry. Based on previous configuration, the commands will be |
| 81 | {{{ |
| 82 | git svn fetch ant-1.7.1 |
| 83 | git svn fetch panc-8.2.11 |
| 84 | git svn fetch saxonb-9.1.0.2J |
| 85 | git svn fetch scdb-ant-utils-8.0.1 |
| 86 | git svn fetch svnkit-1.3.2 |
| 87 | }}} |
| 88 | * Create a branch for tracking each of the remote branch: |
| 89 | {{{ |
| 90 | git branch ant-1.7.1 svn-ant-1.7.1 |
| 91 | git branch panc-8.2.11 svn-panc-8.2.11 |
| 92 | git branch saxonb-9.1.0.2J svn-saxonb-9.1.0.2J |
| 93 | git branch scdb-ant-utils-8.0.1 svn-scdb-ant-utils-8.0.1 |
| 94 | git branch svnkit-1.3.2 svn-svnkit-1.3.2 |
| 95 | }}} |
| 96 | * Create each `external/` directory and clone the repository into them (without checking it out). Following commands must be updated based on your actual configuration: |
| 97 | {{{ |
| 98 | mkdir external |
| 99 | for rep in ant panc saxon svnkit scdb-ant-utils; do git clone -n -s . external/$rep; done |
| 100 | }}} |
| 101 | * Go into each directory and do the following using the appropriate branch created previously: |
| 102 | {{{ |
| 103 | rm -rf .git/refs .git/logs .git/info .git/description .git/config |
| 104 | ln -s ../../.git/refs .git/refs |
| 105 | ln -s ../../.git/logs .git/logs |
| 106 | ln -s ../../.git/info .git/info |
| 107 | ln -s ../../.git/config .git/config |
| 108 | ln -s ../../.git/description .git/description |
| 109 | #Use the appropriate branch name for each subdirectory |
| 110 | git checkout ant-1.7.1 |
| 111 | }}} |
| 112 | |