Advice about branch setup

I'm just switching to teamcity 8, I still have some setup troubles when adapting it to our workflow.

I have a git repository with a master branch and some feature branches.

I have a build configuration that correctly builds a single branch. I have a single agent, and setup the working copy "on the agent".

I have a *very long* pre-build step, which should be done only once per-branch, and can change between different branches. Successive builds of the same branch can fetch the changes
and execute the compiler steps.

The problem comes when I add more branches to the VCS root using the "branch specification".
The issue is that the checkout directory is shared between successive builds of different branches, which I really don't want because the pre-build steps may be incompatible.
Also I don't want to do a working copy cleanup on each rebuild, because the pre-build step is so long.

Ideally I would like to get a different working copy directory for each branch.

for instance

I tryed to do this using a "custom working copy" on the AGENT:


in this way it works (I can get three different working copies), but for some reason the active working copy is cleaned up before each build, even if it's not required (there is a warning about this fact in the settings page).

Is there a way to obtain both of this:
- to separate working copies for each branch being built?
- to avoid working copy cleanup at each build?

Another small question: is there a variable containing the simplified git name ? i.e. the one without refs/heads/ as prefix?

Thank you in advance for any hint!
BTW the product is really really good.

Please sign in to leave a comment.