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

Feature Request: Allow changing blame base. #952

Closed
AlansCodeLog opened this issue Mar 10, 2024 · 1 comment · Fixed by #1002
Closed

Feature Request: Allow changing blame base. #952

AlansCodeLog opened this issue Mar 10, 2024 · 1 comment · Fixed by #1002

Comments

@AlansCodeLog
Copy link

Many times when I'm working and I commit something then several commits later later need to fixup a line in that commit. I make the change but then to know which commit to fixup I sometimes need to git blame the line quickly to find this out, but blame shows "Not Committed Yet".

I already know the state of the line due to the signs (and I have _signs_staged_enable to know if staged/not), so I'd like to be able to just do git blame HEAD instead. Also this would allow something like git blame master in some cases were I would like to blame against master or commits before a certain commit (e.g. an already pushed commit).

Current I'm using fugitive's blame to do this, but it only shows the commit sha, and to get to the commit message you have to use a lot of keystrokes.

Would it be possible to allow changing the base for the blame command? I tried to patch the plugin manually but that didn't work as it seems it's doing some other stuff to detect this special case.

@AlansCodeLog
Copy link
Author

Thank you for the quick implementation ❤️, but it's only partially working. The hunk must still be committed for blame to work and not show "Not Committed Yet". I think I understood the issue this time though. The blame command is using --contents - and reading the file from stdin which causes git to return that it's an external file.

I assume this is done for a reason. Not sure how possible it would be to have it not do this.

For the moment I've removed --contents - from the command and the passing of the lines to stdin and it seems to work more how I want. I'm fine with just keeping my own modified version of the plugin if this breaks other things or is too complicated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment