Fix JGit isBareRepository implementation and add tests

Previous implementation ignored several cases which command line git handles
Fix trailing white space on getMirrorHead definition