This won't account for the executable being run outside of a git directory, but I don't think there will realistically be many instances of that (and it should be able to handle that anyway).