Better current branch detection
Fix AttributeError: 'NoneType' object has no attribute 'read' #3570
Cosmetic
Merge branch 'master' into develop