-
Notifications
You must be signed in to change notification settings - Fork 365
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
cli: remove author name from default annotate template, reorder fields #4653
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this is the easiest fix in the short term, I think it's fine. I'll let others look at this before approving.
I'm hoping this won't be the final state though.
I have some thoughts about the future, but they are not blocking. The most actionable one is the one about dates, but I don't think it is mandatory.
How hard would it be to implement padding?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this is the easiest fix in the short term, I think it's fine.
I believe so. I just want to make the default usable.
How hard would it be to implement padding?
I don't think it's difficult to implement a padding-only function, but we'll need to come up with a nicer syntax.
A padding function would have to support optional min/max widths, padding character, left/right/center alignment. For readability, it's nice if multiple texts can be inlined in a string literal (just like Rust's format!()
.) This means padding function will take another template mini language.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll just approve it then. But let's wait until tomorrow to merge.
6332562
to
4f6bb06
Compare
Just to catch myself up, is the purpose of this PR to remove the author because it messes with alignment? |
Yes, that's the main reason. Another reason is that author name can be long enough to make file contents invisible. So even if we include author, I want to truncate it up to 4-8 characters. BTW, I've implemented padding/truncating function. If we'd like to include author in the default template, it can be something like |
Nice, I see no reason not to merge this PR as is. I can either add author manually with padding as mentioned or discuss in an issue if people feel like it is default-worthy |
Do we like to include author name in the default annotation template? |
I vote yes for showing the author and if anything needs to be cut, omit the commit ID. |
My personal preference would be to include the email, trimmed to (say) 8-10 chars. We could try the trimmed name, but that will be annoying if we have more than one Alexander or Jean-Jacques one day. We could also consider various ways to abbreviate names, but probably not in the first version. It'd also be cool to consider de-duplication, as in #4653 (comment), but that is also complicated. |
4f6bb06
to
0debffe
Compare
Ok, updated the template to include hard-coded (change_id, commit_id, author, timestamp). PTAL. |
+1. What do the rest of you think about removing the commit id? |
I'm torn about the commit id. Showing only the change id is a bit problematic if there are multiple commits with the same commit id, or if we blame hidden revisions. I'm not sure how to address this in a blame view. Update: One option would be to show the commit id instead of the change id in these cases, but that might be confusing. I think it would furthermore be convenient for me to keep the change id, since I'd guess that if I'm blaming, I'm likely to be using other tools at the same time (GitHub, VS Code) that might be more familiar with commit ids. That said, I agree that it's the least important of the things we currently show. |
LGTM, thank you very much! I have some minor suggestions above, but we can experiment with them later as well. This is certainly better than what we had before. |
By the way, there is nothing stopping us from providing a few prefabricated annotate template aliases that the user could swap between, is there? (Probably in a separate PR) Or do we not want the user to configure Also, we probably want to allow something like The one issue I see is that, ideally, the whole line including the line number and content would be templated, but I don't think it's a huge deal if it isn't. |
… commit id The problem is that author names are variable-length by nature, and format_*() can be customized in that way. Commit ids are redundant in most cases where commits aren't diverged. We could add some format_short_fixed_length_*() hook points, but it would probably be easier to just customize the annotation template at all.
0debffe
to
a616c62
Compare
Checklist
If applicable:
CHANGELOG.md