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

Blame view: %(file) refers to old file name, %(file_old) is blank #1226

Closed
Daghall opened this issue Jul 28, 2022 · 2 comments
Closed

Blame view: %(file) refers to old file name, %(file_old) is blank #1226

Daghall opened this issue Jul 28, 2022 · 2 comments
Labels

Comments

@Daghall
Copy link

Daghall commented Jul 28, 2022

In the blame view of a renamed file, the %(file) contains the name of the file at each row's creation.

For example, running :echo %(file) on the two lines below (from src/refs.c) results in the echoing of column number two in the blame view.

395611e src/refs.c   Thomas Koutcher       2022-05-09
5fd811f src/branch.c Jonas Fonseca         2014-02-25

I have not found a use case for the old filename, and my custom commands are not working on these lines, since they try to operate on a file that does not exist anymore.

I think it would be logical to set %(file) to the current filename, and maybe use %(file_old) to refer to the name of the file at the time of the commit.

Is this a bug or a feature? 😄

I have made a workaround for my use case.

@krobelus
Copy link
Contributor

Nice find.
%(file_old) was only implemented for the diff view, we should fix it for the blame view too. I think changing %(file) be the new filename is unlikely to break anyone.
I think the code in src/blame.c uses %(file) (look for string_ncopy(view->env->file,) because at that time there was no %(file_old).

@Daghall
Copy link
Author

Daghall commented Jul 29, 2022

Yeah, I saw that %(file_old) was introduced recently for the diff view, when I stumbled upon it, and discovered it was blank.

It is not listed in the github.io manual, by the way. 😊

@koutcher koutcher added the component:blame Blame UI label Aug 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants