Cherry-pick old rename-detection work

Thanks, @roend83!