Since we're (almost) consistently using the terms `path` and `name` to refer to a complete path and the last component of a path, resp., the use of `name` here is confusing. These variables should be renamed from `oldName` to `oldPath`, etc.