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

feat(plugin-git): remove duplicate no-reply contributors #1364

Merged
merged 5 commits into from Jul 11, 2023

Conversation

lukemassa
Copy link
Contributor

@lukemassa lukemassa commented Jun 18, 2023

Before submitting the PR, please make sure you do the following

  • Read the Contributing Guidelines.
  • Provide a description in this PR that addresses what the PR is solving. If this PR is going to solve an existing issue, please reference the issue (e.g. close #123).

What is the purpose of this pull request?

  • Bug fix
  • New feature
  • Documentation update
  • Other

Description

A user might use multiple mechanisms of contributing code, some directly using their username and email, and others automated, typically with a "noreply" email address. Right now, this causes pages that use the "contributor" to have this somewhat awkward field:

rendered

This change treats the noreply addresses as the "same contributor", if one exists with the same name.

If a file has no such "noreply" addresses, or if there is no corresponding "normal" contributor, the field is unchanged.

Discussion: #1336

Changes

Before

plugin-git % pnpm build && node -e 'import("./lib/node/utils/getContributors.js").then((mod)=>{mod.getContributors(["runatlantis.io/docs/README.md"], "/Users/lukemassa/atlantis").then((value)=>{console.log(value)})})'

> @vuepress/plugin-git@2.0.0-beta.63 build /Users/lukemassa/vuepress-next/ecosystem/plugin-git
> tsc -b tsconfig.build.json

[
  { name: 'Luke Kysow', email: 'lkysow@gmail.com', commits: 6 },
  {
    name: 'Luke Kysow',
    email: '1034429+lkysow@users.noreply.github.com',
    commits: 2
  }
]

After

plugin-git % pnpm build && node -e 'import("./lib/node/utils/getContributors.js").then((mod)=>{mod.getContributors(["runatlantis.io/docs/README.md"], "/Users/lukemassa/atlantis").then((value)=>{console.log(value)})})'

> @vuepress/plugin-git@2.0.0-beta.63 build /Users/lukemassa/vuepress-next/ecosystem/plugin-git
> tsc -b tsconfig.build.json

[ { name: 'Luke Kysow', email: 'lkysow@gmail.com', commits: 6 } ]

@meteorlxy
Copy link
Member

@lukemassa Sorry for delay. Have you checked this one? #537

@Mister-Hope
Copy link
Member

I am actually "upvote" for this kind of changes, it's common to merge a pr and create a new commit through things like github, and people can choose to hide their emails:

image

It's definitely better if we can recognize and remove them in plugin.

@meteorlxy
Copy link
Member

Maybe we'd better merge the commits count instead of simply remove it?

@Mister-Hope
Copy link
Member

Yes, we can merge it if a same name already exists in same file commit, and maybe just remove the email field if not found.

@lukemassa
Copy link
Contributor Author

I added some code to sum up the contributions:

plugin-git % pnpm build && node -e 'import("./lib/node/utils/getContributors.js").then((mod)=>{mod.getContributors(["runatlantis.io/docs/README.md"], "/Users/lukemassa/atlantis").then((value)=>{console.log(value)})})'

> @vuepress/plugin-git@2.0.0-beta.63 build /Users/lukemassa/vuepress-next/ecosystem/plugin-git
> tsc -b tsconfig.build.json

[ { name: 'Luke Kysow', email: 'lkysow@gmail.com', commits: 8 } ]

@meteorlxy meteorlxy merged commit 3ff1b06 into vuepress:main Jul 11, 2023
29 checks passed
@meteorlxy
Copy link
Member

Thanks for your contributions! ❤️

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 this pull request may close these issues.

None yet

3 participants