git: Extract most of the constructor into a separate method.