Add tests for branch name matching.
Use tabs in bash tests.
Makefile: test target depends on binaries.
Fix branch name matching.

Previously in case of several branches with overlapping names
branch with shortest name has been matched.