Strider-CD/strider — pull request #513 by keyvanfatehi (2014-08-09 17:49:11+00:00)
Title: Recover API branch inconsistency issues

The following code ends up giving us the incorrect branch

https://github.com/Strider-CD/strider/blob/master/lib/utils.js#L19-L31

This is what has been causing mysterious branch config persistence issues (like #505) and "UI issues" like #508

So we now detect this and attempt a recovery that directly looks for the branch by name instead of the [findBranch() regex](https://github.com/Strider-CD/strider/blob/master/lib/utils.js#L23). this is all reported in the logs like so:

```
9 Aug 12:41:25 - warn: possibly manipulating unintended branch (expected test, got *) ... trying to recover
9 Aug 12:41:25 - info: found and using intended branch: test
PUT /keyvanfatehi/dew/config/branch/?branch=test 200 71ms - 5b
```