Add a git helper function to detect work trees.