On Wed, Nov 15, 2023 at 05:01:10PM +0100, flobee.code wrote: > But in general I think the exclusion of symlinks to git system files > is a mistake. It is implemented too sweepingly in my eyes. I agree that the fact that we reject these at such a low level makes it hard to use the tooling to rewrite the history to fix it. But because of the security implications of out-of-tree symlinks from untrusted repositories, it's important to catch these consistently. I see your use case is for in-tree links, but detecting that makes the checks much more complex. It also has always been the case that symlinks do not behave consistently, as Git does not follow them when reading in-index versions of meta files. > And `git` itself also aborts. So I can't solve the problems this way. > > git filter-branch --tree-filter 'rm -f .gitmodules' HEAD > Rewrite [SomeHash] (3/185) (0 seconds passed, remaining 0 predicted) \ > error: Invalid path '.gitmodules' Could not initialize the index I didn't test, but you could probably get by with using "git replace" to first fix up the offending trees, and then run filter-branch (though there may be a lot of such trees, so you'd probably to script that step). I also suspect that filter-repo would handle this better: https://github.com/newren/git-filter-repo but didn't try it myself. -Peff