Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

file history does not follow file renames #1879

Open
extrawurst opened this issue Sep 5, 2023 · 8 comments · May be fixed by #1881
Open

file history does not follow file renames #1879

extrawurst opened this issue Sep 5, 2023 · 8 comments · May be fixed by #1881
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@extrawurst
Copy link
Owner

I just renamed CHANGELOG.md to -> CHANGELOG-2.md and this is how the file history of it looks like:

Screenshot 2023-09-06 at 00 09 52

original implementation happened in #381 by @cruessler

@extrawurst extrawurst added the enhancement New feature or request label Sep 5, 2023
@extrawurst
Copy link
Owner Author

extrawurst commented Sep 5, 2023

Unfortunately the rename detection happens on a diff level which means if we do the fast log walk with path spec filtering we won’t be able to detect renames. We need to actually benchmark this: maybe we just use the full revwalk and filter out diffs not touching the file in question or something more fancy like starting a new revwalk from the commit that does a rename which we can check if we find the added commit of the file

@cruessler
Copy link
Contributor

@extrawurst Did you check what other tools, namely tig, do in this case? If they follow renames and are still reasonably fast, maybe we can get inspiration from their implementation.

@extrawurst
Copy link
Owner Author

Even git_blame_file follows renames. We can look into that one :)

@cruessler
Copy link
Contributor

That fact significantly increases my hope that there is a simple way of following renames. :-)

@extrawurst

This comment was marked as outdated.

@extrawurst
Copy link
Owner Author

extrawurst commented Sep 6, 2023

actually it does exactly what I suspected internally:

rev walk starting with current filename:

  1. first a fast path-specced diff to see if we can sort this commit out early
  2. if it touches current, do a full-diff to apply rename-detection
  3. if it is in fact a rename change the current filename and proceed with the revlog

interestingly they do not apply the optimisation that I had in mind: the status of the modification of the file in step 1. can be used to skip 2. if the status is not a file-add because a rename effectively looks like the initial commit of a file (with the new name)

@extrawurst extrawurst linked a pull request Sep 6, 2023 that will close this issue
@extrawurst extrawurst added this to the v0.25 milestone Oct 16, 2023
@extrawurst extrawurst modified the milestones: v0.25, v0.26 Feb 19, 2024
@extrawurst
Copy link
Owner Author

@cruessler can you pick this up next? it should really be close to finish the PR

@cruessler
Copy link
Contributor

I’ll have a look!

@extrawurst extrawurst modified the milestones: v0.26, v0.27 Apr 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants