Depending on platform, you should be able to find out what syscalls Git uses to figure out its status. Try strace git status on Linux, truss git status on SunOS, or the seemingly DTrace-based tool that Apple ships with its Developer Tools on Mac OS X.