Branch name and hash didn't work properly when having disconnected HEAD or when having current HEAD below upstream.