Detect branch better. Don't forget to clean autorevision.h in core.