add rename

This avoids creating the target directory if the old and new path are
identical.

required for js-git data integrity fix I'm about to push.
Though I guess since you're using an else, it's not strictly required, it's just the style I use everywhere.