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

Please add Custom Author Label into configs #181

Closed
Antecer opened this issue Sep 24, 2024 · 7 comments
Closed

Please add Custom Author Label into configs #181

Antecer opened this issue Sep 24, 2024 · 7 comments

Comments

@Antecer
Copy link

Antecer commented Sep 24, 2024

Gitlens plugin replace my "author.name" to "You".
But git blame only shows my git name.

I think I need a new options variable (Git Blame: Custom Author Label) to substitute my own author name.
Please don't try to make it display "you" like gitlens, but add a custom label so that it can adapt to the preferences of different users.

@Sertion
Copy link
Owner

Sertion commented Sep 25, 2024

Hey Antecer! Thanks for the feature request.

I have some ideas on how this could be implemented, but I need some thought on how you would prefer how to deal with it:

  • What defines "you" in this case? That user.name matches? That user.email matches? That both user.name and user.email matches?
  • Should author.name replace to the same setting value in the inline view, status bar view, informationMessage, and the various URLs or only some of them?
  • Should it apply to both author.name and committer.name or would that be unexpected?

@Antecer
Copy link
Author

Antecer commented Sep 27, 2024

I think it would be a good idea to just add a new definable string to replace ${author.name}.
Users can set their own, or keep the default author.name

I don't know the best way to match 'me' because I don't know if author.name allows duplicate values, and the only requirement here is to identify which code was submitted by 'me'.
Maybe we can match the git login token or see how gitlens does it.

@Sertion
Copy link
Owner

Sertion commented Sep 27, 2024

Thanks for the input!

I had a look at the Gitlens implementation and it sadly does not contain anything that can be reused here. It is only possible to have one user.name and user.email per repository so matching the email is probably what I'll do.

Will probably also apply this in all cases except URLs and for both author.name and committer.name.

@Sertion
Copy link
Owner

Sertion commented Sep 27, 2024

I've built a pre-release and I would love if you had a look to see if it works the way you expect!

I added a new setting called gitblame.currentUserAlias. If it is set and a commit user's email or committer's email matches git config user.email it will replace that {author|committer}.name.

gitblame-11.1.0-prerelease.zip

@Antecer
Copy link
Author

Antecer commented Sep 28, 2024

I've built a pre-release and I would love if you had a look to see if it works the way you expect!

I added a new setting called gitblame.currentUserAlias. If it is set and a commit user's email or committer's email matches git config user.email it will replace that {author|committer}.name.

gitblame-11.1.0-prerelease.zip

it will replace all {author.name}, we only need replace the {author.name} for 'me'.

@Sertion
Copy link
Owner

Sertion commented Sep 28, 2024

Thank you for testing it. Sorry that it had an issue. I've corrected it.

gitblame-11.1.0-prerelease2.zip

@Antecer
Copy link
Author

Antecer commented Oct 3, 2024

Thank you for testing it. Sorry that it had an issue. I've corrected it.

gitblame-11.1.0-prerelease2.zip

Now, it works good!
Thank you for your work.

@Antecer Antecer closed this as completed Oct 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants