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

git .mailmap not honoured #58

Closed
shoffmeister opened this issue Oct 1, 2023 · 6 comments
Closed

git .mailmap not honoured #58

shoffmeister opened this issue Oct 1, 2023 · 6 comments

Comments

@shoffmeister
Copy link

git offers tuning of rendered log information through a .mailmap file, see https://git-scm.com/docs/gitmailmap

Unfortunately, this extension does not appear to honour any such configuration (and neither does mhutchie's extension, FWIW).

Running the plain git log --graph on the command-line shows rendered output which takes into account .mailmap configuration.

Having a .mailmap is beneficial in a number of scenarios:

  • fix errors users made in their setting up of git
  • email addresses may change
  • names may change

With a .mailmap file, all these glitches can be removed for a nice and clean view of authors.

To reproduce, run this on the root of your local working copy

cat > .mailmap <<EOF
Hello Philip! <philip@waritschlager.de>
EOF

git log --graph

Note that the output shows an adjusted user name.

Open git-log--graph in Visual Studio Code and notice that the .mailmap configuration has not been applied.

@shoffmeister
Copy link
Author

It would seem as if post-processing the revision result set using https://git-scm.com/docs/git-check-mailmap would trivially allow resolving to what is configured in the .mailmap file:

git check-mailmap '<philip@waritschlager.de>'

Assuming that the Linux kernel is representative for the worst-case at https://github.com/torvalds/linux/blob/master/.mailmap, doing that lookup may not be all that bad. The only problem could be the Windows command-line with its limited input length (requiring splitting into multiple invocations, at worst)

Using git check-mailmap would have the massive benefit of getting all the benefit of config (location) parsing - because my .mailmap files are configured to be all over the place ;)

@phil294
Copy link
Owner

phil294 commented Oct 1, 2023

Hi @shoffmeister, welcome onboard!

git log --graph
Note that the output shows an adjusted user name.
Open git-log--graph in Visual Studio Code and notice that the .mailmap configuration has not been applied.

Interesting observation. Why are both outputs different though? This very extension runs and parses the very same command internally. So perhaps adjusting the --pretty=format: in store.coffee to render the mapped mails could be enough?

@phil294
Copy link
Owner

phil294 commented Oct 1, 2023

anyway, I didn't know this feature existed, and I agree it would be beneficial to support!

@phil294
Copy link
Owner

phil294 commented Oct 1, 2023

yup, found this in man git log under PRETTY FORMATS:

               %an
                   author name

               %aN
                   author name (respecting .mailmap, see git-shortlog(1) or git-blame(1))

               %ae
                   author email

               %aE
                   author email (respecting .mailmap, see git-shortlog(1) or git-blame(1))

we're currently using %an and %ae.

so apparently only two letters need to be adjusted.

It's a shame because your respective PR is awesome, both syntactically and semantically - but it seems the coding effort was in vain ;(

@shoffmeister
Copy link
Author

Oh no! RTFM rulez again!

Well, it was a nice excursion into "What is CoffeeScript?!" and the developer experience for Visual Studio extension development was surprisingly pleasant.

So, what do we do with the PR? Closing it seems to be the way to go?

@phil294 phil294 closed this as completed in cc1238d Dec 1, 2023
@phil294
Copy link
Owner

phil294 commented Dec 1, 2023

Well, it was a nice excursion into "What is CoffeeScript?!" and the developer experience for Visual Studio extension development was surprisingly pleasant.

I'm pleased to hear that!

So, what do we do with the PR? Closing it seems to be the way to go?

Yes, I'm afraid that's the only thing to do now. I have changed the to letters as outlined above in the source now. Fix now available with v0.1.13. Would be great if you could test it out some day!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants