[vtk-developers] Safe-area clones (was: Auto install git hooks)

Brad King brad.king at kitware.com
Tue Jul 6 11:36:55 EDT 2010


On 07/01/2010 10:58 AM, Stephane PLOIX wrote:
> 
> I think I may not have been clear :
> my setup is the following :
> kitware official PV git repo <-- internal PV clone <-- developper PV clone
> kitware official VTK git repo <-- internal VTK clone  <-- developper VTK
> clone
> etc...
[snip]
> the submodules for instance :
> by default, they point to kitware's native repos, and have to be
> reconfigured to point to the internals clones with commands like
>>>>git config submodule.VTK.url git://my-internal-VTK-clone

Look at "git help config" for this option:

 url.<base>.insteadOf
  Any URL that starts with this value will be rewritten to start,
  instead, with <base>. In cases where some site serves a large
  number of repositories, and serves them with multiple access
  methods, and some users need to use different access methods, this
  feature allows people to specify any of the equivalent URLs and
  have git automatically rewrite the URL to the best alternative for
  the particular user, even for a never-before-seen repository on the
  site. When more than one insteadOf strings match a given URL, the
  longest match is used.

This can make use of ParaView with its submodules much easier for
your situation.  Configure the mapping in your ~/.gitconfig:

 git config --global url."git://my-repos".insteadOf git://vtk.org

Then you can just use all the Kitware repository URLs and Git will
follow your internal safe-area clones automatically.  If you run

 git clone git://vtk.org/VTK.git

it will really fetch from "git://my-repos/VTK.git".  The .git/config
file will still report "git://vtk.org/VTK.git" but the mapping
rewrites it every time.

There is also "url.<base>.pushInsteadOf" to rewrite push URLs.

-Brad



More information about the vtk-developers mailing list