frej / fast-export

A mercurial to git converter using git-fast-import
http://repo.or.cz/w/fast-export.git
808 stars 255 forks source link

Renaming files ignores file deletions #318

Closed amb007 closed 6 months ago

amb007 commented 7 months ago

This chunk in export_commit (in the version used by ht-export-tool):

  for filename in removed:
    if fn_encoding:
      filename=filename.decode(fn_encoding).encode('utf8')
    filename=strip_leading_slash(filename)
    if filename==b'.hgsub':
      remove_gitmodules(ctx)
    wr(b'D %s' % filename)

  export_file_contents(ctx,man,added,hgtags,fn_encoding,plugins)
  export_file_contents(ctx,man,changed,hgtags,fn_encoding,plugins)

allows the export_file_contents to rename a file via a file_data_filter plugin, but then uses the original name if the file is removed in a later commit.

frej commented 7 months ago

There is no call to the file_data_filter for deleted files, that looks like an omission. Perhaps we could add a call and call the plugin with the file contents as None?