FabijanZulj / blame.nvim

Neovim fugitive style git blame plugin
MIT License
310 stars 19 forks source link

Support file renaming in older commits #31

Closed ouuan closed 5 months ago

ouuan commented 5 months ago

The "blame stack" feature should use the commit.filename instead of the initial filename on pushing, in case that the file was renamed in older commits.

Basically, we need this change:

@@ -216,6 +216,8 @@ function BlameStack:push(commit)
         })
     end

+    self.file_path = commit.filename
+
     vim.api.nvim_set_current_win(self.original_window)
     vim.api.nvim_set_current_buf(self.stack_buffer

However, I'm messed up with cwd and other commands and haven't figured out how to properly handle them.

FabijanZulj commented 5 months ago

Hmm, Is this a reliable way to follow renames? If it is, awesome! Ill figure out cwd with git root and relative/absolute paths.

Appreciate the input :)

ouuan commented 5 months ago

Hmm, Is this a reliable way to follow renames?

It seems so. I'm not sure if it's reliable, but it works in my test.