Fix the finicky parsing logic and just ask git the necessary information directly.
Powered by TurnKey Linux.