Merge pull request #5466 from pks-t/pks/patch-modechange-with-rename patch: correctly handle mode changes for renames