mirror of
https://github.com/newren/git-filter-repo.git
synced 2024-07-06 02:12:17 +02:00
filter-repo: fix cache of file renames
Users may have long lists of --path, --path-rename, --path-regex, etc. flags (or even a --paths-from-file option with a lot of entries in the file). In such cases, we may have to compare any given path against a lot of different values. In order to avoid having to repeat that long list of comparisons every time a given path is updated, we long ago added a cache of the renames so that we can compute the new name for a path once and then just reuse it each time a new commit updates the old filepath. Sadly, I flubbed the implementation and instead of setting cache[oldname] = newname I somehow did the boneheaded cache[newname] = newname For most repositories and rewrites, this would just have the effect of making the cache useless, but it could wreak various kinds of havoc if a newname matched the oldname of some other file. Make sure we record the mapping from OLDNAME to newname to fix these issues. Signed-off-by: Elijah Newren <newren@gmail.com>
This commit is contained in:
parent
85c8e3660d
commit
b9c62540b7
@ -3254,11 +3254,12 @@ class RepoFilter(object):
|
||||
if change.filename in self._newnames:
|
||||
change.filename = self._newnames[change.filename]
|
||||
else:
|
||||
original_filename = change.filename
|
||||
change.filename = newname(args.path_changes, change.filename,
|
||||
args.use_base_name, args.inclusive)
|
||||
if self._filename_callback:
|
||||
change.filename = self._filename_callback(change.filename)
|
||||
self._newnames[change.filename] = change.filename
|
||||
self._newnames[original_filename] = change.filename
|
||||
if not change.filename:
|
||||
continue # Filtering criteria excluded this file; move on to next one
|
||||
if change.filename in new_file_changes:
|
||||
|
Loading…
Reference in New Issue
Block a user