Can I easily test from the CLI if a certain branch would be matched by the following branch configuration in the Team City settings? I am assuming this branch config actually relies on some Git internals.
+:refs/heads/develop
+:refs/heads/xmas-lottery-hotfix-branch
+:refs/heads/hotfix*
For instance, I would like to test if hotfix/foo
would be covered by this config, or if I would need to change it. Simply sending empty commits to various branches and see if it triggers a build in TC is not easy and quick testing, although that works as well ...
The config above directly references the file system layout of git. If you dive into the .git
folder of your cloned repo you will find a refs
folder containing several directories and subdirectories. These correspond to local (in heads
) and remote branches. They might also contain other special branches (like pulls
on GitHub).
To check of a config matches one or several branches you can just use the normal options afforded to you by your shell (here using Bash on my local Sinon repo):
echo sinon/.git/refs/*/*zam*
sinon/.git/refs/heads/zamnuts-restore-etters-1124 sinon/.git/refs/remotes/zamnuts
This shows that a branch specifier of refs/*/*zam*
would match these two branches (one locally checked out pull request and a remote branch). It should be very easy to modify this to your needs.