# Hooks broken if ITK as part of a SuperProject

**URL:** https://discourse.itk.org/t/hooks-broken-if-itk-as-part-of-a-superproject/434
**Category:** Community
**Tags:** git-hooks
**Created:** [November 20, 2017, 4:53pm UTC](https://discourse.itk.org/t/hooks-broken-if-itk-as-part-of-a-superproject/434 "2017-11-20T16:53:51Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![david.kuegler](https://discourse.itk.org/user_avatar/discourse.itk.org/david.kuegler/32/169_2.png) [@david.kuegler](https://discourse.itk.org/u/david.kuegler)
#### Post date: [November 20, 2017, 4:53pm UTC](https://discourse.itk.org/t/hooks-broken-if-itk-as-part-of-a-superproject/434/1 "2017-11-20T16:53:51Z")

</div>

Hi,

I tried to set ITK up as part of a superbuild and the gerrit integration does not work “at all” …

This makes me reluctant on contributing (this is mostly due to the custom hooks not being properly set up).

How to recreate:

- create a “personal superbuild”
- create a submodule for itk
- develop a patch within that submodule
- try to set up the hooks with Utilities/SetupForDevelopment.sh

– this does not work since if does not find …/…/.git/hooks (which does not exist, since it is a superbuild project)

Solution: Fix SetupForDevelopment.h for Superbuilds

David

---

<div class="post-metadata">

### Author: ![blowekamp](https://discourse.itk.org/user_avatar/discourse.itk.org/blowekamp/32/79_2.png) [@blowekamp](https://discourse.itk.org/u/blowekamp)
#### Post date: [November 20, 2017, 5:02pm UTC](https://discourse.itk.org/t/hooks-broken-if-itk-as-part-of-a-superproject/434/2 "2017-11-20T17:02:09Z")

</div>

In your superbuild, how are you getting ITK? git? tar-ball?

Some superbuild projects allow the setting of the source code directory of the sub-projects (ITK), this allows you to build the superbuild project against a custom version of the external project. This is much better that editing files in a check out source directory that is part of the superbuild build directory, because the superbuild may modify or change that checked out/untared directory when a top-level build is done.

---

<div class="post-metadata">

### Author: ![david.kuegler](https://discourse.itk.org/user_avatar/discourse.itk.org/david.kuegler/32/169_2.png) [@david.kuegler](https://discourse.itk.org/u/david.kuegler)
#### Post date: [November 20, 2017, 5:04pm UTC](https://discourse.itk.org/t/hooks-broken-if-itk-as-part-of-a-superproject/434/3 "2017-11-20T17:04:30Z")

</div>

Well, since it is my personal superbuild, I want it to have everything in there, because that way I have the same environment on all machines and do not manually need to update everything.

As you might be ablt to read from the initial post, I am kinda frustrated…

---

<div class="post-metadata">

### Author: ![matt.mccormick](https://discourse.itk.org/user_avatar/discourse.itk.org/matt.mccormick/32/7_2.png) [@matt.mccormick](https://discourse.itk.org/u/matt.mccormick)
#### Post date: [November 20, 2017, 6:37pm UTC](https://discourse.itk.org/t/hooks-broken-if-itk-as-part-of-a-superproject/434/4 "2017-11-20T18:37:58Z")

</div>

Hi David,

Can you share the project so the issue can be reproduced?

Thanks,  
Matt

---

<div class="post-metadata">

### Author: ![david.kuegler](https://discourse.itk.org/user_avatar/discourse.itk.org/david.kuegler/32/169_2.png) [@david.kuegler](https://discourse.itk.org/u/david.kuegler)
#### Post date: [November 20, 2017, 6:50pm UTC](https://discourse.itk.org/t/hooks-broken-if-itk-as-part-of-a-superproject/434/5 "2017-11-20T18:50:11Z")

</div>

Unfortunately I cannot, but I quickly reproduced the errors by:

1. creating a new repo (by TortoiseGIT)

2. creating a submodule within (/itk) sourcing from itk (git://itk.org/ITK.git) (by TortoiseGIT)

3. Trying to run [SetupForDevelopment.sh](http://SetupForDevelopment.sh) (on a cygwin Terminal) (see below)

Also running the script from the top level folder does not work either…

---

<div class="post-metadata">

### Author: ![david.kuegler](https://discourse.itk.org/user_avatar/discourse.itk.org/david.kuegler/32/169_2.png) [@david.kuegler](https://discourse.itk.org/u/david.kuegler)
#### Post date: [November 20, 2017, 6:56pm UTC](https://discourse.itk.org/t/hooks-broken-if-itk-as-part-of-a-superproject/434/6 "2017-11-20T18:56:24Z")

</div>

Well, in order to work properly, I think SetupForDevelopment would need to be modified, so it can actually “reroute” to super/.git/modules/itk instead of …/…/.git

SetupForDevelopment seems to be just not compatible with superbuilds…

I remember there was a similar issue once in the plus toolkit (they seem to have copied the script from ITK).

> <https://github.com/PlusToolkit/PlusLib/blob/master/Utilities/SetupForDevelopment.sh>

But I think it might have been solved there…

> <https://github.com/PlusToolkit/PlusLib/commit/cacc60c1f9f029e0d96630aa7fe5100d9ec55dee#diff-c8ec606362aed96eb2fc0813b0dc6923>

---

<div class="post-metadata">

### Author: ![matt.mccormick](https://discourse.itk.org/user_avatar/discourse.itk.org/matt.mccormick/32/7_2.png) [@matt.mccormick](https://discourse.itk.org/u/matt.mccormick)
#### Post date: [November 20, 2017, 7:28pm UTC](https://discourse.itk.org/t/hooks-broken-if-itk-as-part-of-a-superproject/434/7 "2017-11-20T19:28:08Z")

</div>

Thanks for the details, David.

[This patch](http://review.source.kitware.com/#/c/22808/) will address the issue.

---

<div class="post-metadata">

### Author: ![dzenanz](https://discourse.itk.org/user_avatar/discourse.itk.org/dzenanz/32/1093_2.png) [@dzenanz](https://discourse.itk.org/u/dzenanz)
#### Post date: [November 20, 2017, 9:30pm UTC](https://discourse.itk.org/t/hooks-broken-if-itk-as-part-of-a-superproject/434/8 "2017-11-20T21:30:09Z")

</div>

@matt.mccormick It looks like you double-pushed to gerrit. You abandoned the patch which you linked. The active one is [here](http://review.source.kitware.com/#/c/22809/).
