I have jenkins set up to build any branch and merge it into master. I also have pre-receive scripts to prevent any developer from checking into master unless you are user "hudson".

It is working great on one of our repositories but on the other one, any time someone pushes a new remote branch, hudson is building a paused unworking branch and failing the build so each new push a remote branch triggers an immediate build(post-receive script calls curl) but then it tries to build that bad branch instead of the one the developer pushed.

NOTICE in the logs, it looks like it detects correctly that dhiller-1 was the latest pushed but then decides to build dhiller-refactor which is not complete but kept in remote repository as it is a big refactor that is still in progress(and pushed only for backup purposes)

logs...

```
Started by user anonymous
Checkout:workspace / C:\AAROOT\Jenkins2\jobs\toolbar\workspace - hudson.remoting.LocalChannel@aab87f
Using strategy: Default
Last Built Revision: Revision 597af7a5d808b28f492257f311af9171f03e6891 (origin/dhiller-1)
Checkout:workspace / C:\AAROOT\Jenkins2\jobs\toolbar\workspace - hudson.remoting.LocalChannel@aab87f
Fetching changes from 1 remote Git repository
Fetching upstream changes from ssh://hudson@192.168.111.130/opt/toolbar
Seen branch in repository origin/HEAD
Seen branch in repository origin/dhiller-1
Seen branch in repository origin/dhiller-2
Seen branch in repository origin/dhiller-refactor
Seen branch in repository origin/dhiller-test
Seen branch in repository origin/master
Commencing build of Revision 2c56d8645871ea2929c717e15038a5b79c0b43e1 (origin/dhiller-refactor)
Merging Revision 2c56d8645871ea2929c717e15038a5b79c0b43e1 (origin/dhiller-refactor) onto master
ERROR: Branch not suitable for integration as it does not merge cleanly
Build did not succeed and the project is configured to only push after a successful build, so no pushing will occur.
Finished: FAILURE

```