f-person / git-blame.nvim

Git Blame plugin for Neovim written in Lua
GNU General Public License v3.0
884 stars 43 forks source link

Ignore commits that move a file #123

Open AckslD opened 7 months ago

AckslD commented 7 months ago

I recently learned about the -C flag of git blame which can be added 0 to 3 times and make eg commits that just move away to be ignored. This is usually what I actually want to see and I was wondering if it could make sense to expose that as a configuration option or an option to the command directly?

f-person commented 7 months ago

Oh, hi!

which can be added 0 to 3 times

Could you expand a bit on this one?

if it could make sense to expose that as a configuration option or an option to the command directly

Yeah, this seems to make sense initially.

marcelarie commented 7 months ago

I am interested in this feature too.

Could you expand a bit on this one?

All the information that I have is from an article on Git Butler, but in resume, The -C option ignores code movements between files or lines when using the git blame command. It only shows changes to the code itself, rather than movements.

Example where in the first command uses a normal git blame and in the second it used git blame -C -C -C:

image

here the article: https://blog.gitbutler.com/git-tips-1-theres-a-git-config-for-that/#git-blame-with-following

marcelarie commented 7 months ago

I think that for the plugin, a nice feature will be to add the parameters that we want to add to the git blame command.

For example:

let g:gitblame_parameters = ['-w', '-C', '-C', '-C']

and then this should run as:

git blame -w -C -C -C
AckslD commented 7 months ago

Thanks @marcelarie, I also got this tip from a very similar source, in a recent talk by the Scott from git butler: https://www.youtube.com/watch?v=aolI_Rz0ZqY (at ~11:50).

I think a setting could be nice but maybe also the ability to pass flags to eg GitBlameToggle and then you can do eg:

:GitBlameToggle -w -C

or similar. Not sure exactly how that should interact with default options though?

marcelarie commented 7 months ago

Yes that sounds amazing. btw I think the article is from Scott too.

f-person commented 7 months ago

Thanks for the explanation @marcelarie!

I think that for the plugin, a nice feature will be to add the parameters that we want to add to the git blame command.

Yup, I agree it would be nice! However, for this particular one, I'd also like it to be a setting so that people can see that they can do this :) (maybe even make this default..? 🤔)

I think a setting could be nice but maybe also the ability to pass flags to eg GitBlameToggle

I don't mind having that but don't think it's as important :)