Cache results to avoid calling git twice