convert common_prefix() to use struct pathspec