insights: fix empty repo checks
Created by: chwarwick
Consolidates logic for getting first git commit and making it easier to deal with empty repos.
related to https://github.com/sourcegraph/sourcegraph/issues/35450
Test plan
unit tests pass Manually verified insight creation with & without empty repos