Fix detection of when a build is needed with better git fu