The function strip_common_ancestors strip the path from the ancestor to the file
but now only the ancestor with the highest index is taken into account.