Add index support to gitfs
Be more precise in the error check for invalid index