git storage: handle file renames between folders #6020
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I've discovered that my implementation of handling moved or renamed files for git storage in #4307 was incomplete. It turns out that if the old and new file paths have common elements,
git diff --stat -M <hash-before> <hash-after>
(called bythis.git.diffSummary
) will display them in a compressed format using braces. This commit updates the logic to handle all the non-renaming, simple renaming, and compressed renaming formats that I was able to find. Examples are below:This also updates the
destinationTitle
logic to better detect and update page titles that have not been updated since being auto-generated from the page's path, which originally worked only for top-level pages.This should fix the behaviour observed in #4701 and potentially #4677.