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] Consolidate duplicate contributor names #236

Closed
Jojoshua opened this issue Aug 15, 2024 · 7 comments
Closed

[Feature request] Consolidate duplicate contributor names #236

Jojoshua opened this issue Aug 15, 2024 · 7 comments

Comments

@Jojoshua
Copy link

Clear and concise description of the problem

It's not uncommon for enterprises to switch their internal email addresses so you will have git commits for the same name but different email addresses.

Suggested solution

The contributor names should be distinct regardless of the email address or number of commits. In the rare case it truly is actually 2 different people with the same name, having the same name twice doesn't provide any value.

Alternative

No response

Additional context

No response

@Mister-Hope Mister-Hope transferred this issue from vuepress/core Aug 15, 2024
@Mister-Hope
Copy link
Member

This is a plugin git thing, we can consider merging contributors and assigning their email with the last one they use.

We need a new option for this, and I think we can either make this opt-in or make your description as default and make the current opt-in.

It should be not hard to open a pr for this, I am at covid with fever, so I would invite you to open a pr.

Looking for the option ideas feed back with @pengzhanbo and @meteorlxy .

@pengzhanbo
Copy link
Member

I think we can merge emails similarly to commits, based on whether they have the same name, separating them with a ,. Perhaps we should rename the field to emails. Should the option be named mergeSameContributor?
@Mister-Hope @meteorlxy

Copy link

github-actions bot commented Sep 1, 2024

This issue is marked as stale because it has not had recent activity. Issues marked with stale will be closed if they have no activity within 7 days.

@github-actions github-actions bot added the stale label Sep 1, 2024
@Mister-Hope Mister-Hope removed the stale label Sep 1, 2024
@meteorlxy
Copy link
Member

having the same name twice doesn't provide any value.

@Jojoshua In fact we also display the email when hovering on the name, so it actually has some value to display duplicate names:

image

IMO it could be better to provide an option to let user customize the merging strategy, maybe something like:

gitPlugin({
  contributors: true,
  contributorsMerging: (a, b) => {
    // return false to avoid merging
    if (a.name !== b.name) return false
    return {
      name: a.name,
      email: a.email.endsWith('@personal.com') ? a.email : b.email,
      commits: a.commits + b.commits,
    }
  },
})

Or simply provide the raw contributors array directly:

gitPlugin({
  contributors: true,
  contributorsHandling: (contributors) => {
    return contributors.filter(() => { /* whatever */ })
  },
})

@Mister-Hope
Copy link
Member

What about transformContribors?

@Mister-Hope
Copy link
Member

d431dc4

@Jojoshua
Copy link
Author

Thanks for the new function!

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

4 participants