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

There were a few places where detecting the current git revision just doesn't work when the scripts are run from outside the repo directory. This fixes it. You can now run 'xctool.sh' from wherever you want and it all works fine.