Every branch is shown twice with "refs/heads/"-Prefix and without - only prefixed ones are triggered automatically.

Teamcity shows almost every branch in my build configuration twice. Once with a "refs/heads"-Prefix, once without. Unfortunately some branches (no pattern detected so far) are only available without the prefix. Additionally, while all refs/heads/* Branches are triggered as expected, the ones without need to be triggered manually the first time. After that they are triggered automatically.

All my branch specifications use "+:*" to detect branches. Why does TC show those branches in two different ways and why is only the one pattern triggering the Build? I would like to handle only one pattern, plus make sure I don't miss branches when I simply filter out branches without the prefix.


Branch specification and filter in VCS root:

Comment actions Permalink
Hi! It looks like branch specification used to be something like +:refs/heads/*, and there have been builds run in the affected branches before the change. If that's the case, the builds that checked out the ref before the change will have a differ logical branch name then the builds checking out the same ref after the change. While the builds having the old logical branch name are still there in the history, their logical branch name will show up in the branch dropdown.
You can find out more about the logical branch name here: https://www.jetbrains.com/help/teamcity/working-with-feature-branches.html#Logical+branch+name
Comment actions Permalink

Hey, Anatoly Cherenkov. Thanks for your quick reply. Unfortunately, this is not the case. Also branches created after the last changes are recognized once with - and once without the /refs/heads prefix and the branch without prefix collects pending changes. I have attached a screenshot showing such a branch. Do you have any ideas how to solve the problem or why Teamcity displays the branches twice in the first place?

Comment actions Permalink

Another possibility is if two VCS roots that are pointed to the same repo but have different branch specifications are attached to the build configuration.

Also, according to the VCS root settings screenshot and branch filter screenshot, the settings don't seem entirely correct. The VCS root settings work with branch refs like "refs/heads/master", while the branch filter works with logical branch names like "master". You check the difference here: https://www.jetbrains.com/help/teamcity/working-with-feature-branches.html#Logical+branch+name

It looks like the default branch in your case should be:

The branch specification should be something like this:

That would result in the logical branch names (the ones you see in the branch dropdown on the build configuration overview page) not having the "refs/heads/" prefix.

And the branch filters should be something like this (use the magic wand icon to pick the desired logical names from the UI to minimize the human error):

Comment actions Permalink

Thanks, Anatoly Cherenkov. We indeed confused Syntax for branch specification and filters. Using the appropriate Syntax helped. Still it would have been useful to become some kind of error message instead of a not correctly but somehow working setup due to wrong Syntax. Thanks for your help!


Please sign in to leave a comment.