move git parsing logic into lib with tests