Search code examples
gitgit-filter-repo

How do I resolve "File renaming caused colliding pathnames!" from git filter-repo --path-rename?


I'm getting a File renaming caused colliding pathnames! error from git filter-repo --path-rename (path names hidden due to closed source/confidentiality):

gdlxn@geoff-test4:<git-repo>$ git filter-repo --replace-refs delete-no-add --path-rename <old-path>:<new-path> --force
File renaming caused colliding pathnames!
  Commit: b'd8ab28d76da9371bf1db0dac8870122e57dc6713'
  Filename: b'<new-path>'
fatal: stream ends early
fast-import: dumping crash report to .git/fast_import_crash_415589

My git repository contains a single master branch. I've been unable to reproduce the File renaming caused colliding pathnames! error in a small example. So what exactly is meant by colliding pathnames in this context? Any help in understanding the error, and more importantly how to resolve it, would be greatly appreciated.


Solution

  • It turns out that tracing the git-repo-filter code wasn't as hard as I expected. I found that File renaming caused colliding pathnames! from git filter-repo --path-rename <old-path>:<new-path> occurs when there's a commit in the commit history in which

    1. the commit contains changes to both <old-path> and <new-path>
    2. the change to <new-path> is not a delete
    3. the resulting changes to <old-path> and <new-path> are not identical

    Based on this, I'm not sure if there is a general way to resolve the File renaming caused colliding pathnames! error.