git-subtree: guess directory in other commands as well

This took some refactoring to get right. $prefix handling is now
done inside the functions implementing the commands.