Fix JGit isBareRepository implementation and add tests

Previous implementation ignored several cases which command line git handles
Fix trailing white space on getMirrorHead definition
Fix compile error
Merge remote-tracking branch 'wheezy64b/proto-fix-JGit-isBareRepository' into proto-fix-JGit-isBareRepository