Programmatically checking for uncommitted changes. I believe this is basically what Magit (when calling list-directories) offers as well.