Checking path to git repository optimized