Skip to content

Teach GitGitGadget to guess the full name and email address of new contributors #153

Open

Description

@dscho

Since new contributors usually contribute their own code, we can make use of the REST API to get a single commit that has enough information to guess the full name and email address of a contributor.

Example produces this:

{
  "sha": "ccc6fb45580e1c07b143d1a55d9518c13ac3c032",
  "node_id": "MDY6Q29tbWl0MjMyNjA0NzpjY2M2ZmI0NTU4MGUxYzA3YjE0M2QxYTU1ZDk1MThjMTNhYzNjMDMy",
  "commit": {
    "author": {
      "name": "Slavica Đukić",
      "email": "slawica92@hotmail.com",
      "date": "2019-02-14T10:41:46Z"
    },
    "committer": {
      "name": "Johannes Schindelin",
      "email": "johannes.schindelin@gmx.de",
      "date": "2019-11-14T14:35:15Z"
    },
[...]
  "author": {
    "login": "slavicaDj",
    "id": 26170660,
    "node_id": "MDQ6VXNlcjI2MTcwNjYw",
    "avatar_url": "https://avatars0.githubusercontent.com/u/26170660?v=4",
    "gravatar_id": "",
    "url": "https://api.github.com/users/slavicaDj",
    "html_url": "https://github.com/slavicaDj",
    "followers_url": "https://api.github.com/users/slavicaDj/followers",
    "following_url": "https://api.github.com/users/slavicaDj/following{/other_user}",
    "gists_url": "https://api.github.com/users/slavicaDj/gists{/gist_id}",
    "starred_url": "https://api.github.com/users/slavicaDj/starred{/owner}{/repo}",
    "subscriptions_url": "https://api.github.com/users/slavicaDj/subscriptions",
    "organizations_url": "https://api.github.com/users/slavicaDj/orgs",
    "repos_url": "https://api.github.com/users/slavicaDj/repos",
    "events_url": "https://api.github.com/users/slavicaDj/events{/privacy}",
    "received_events_url": "https://api.github.com/users/slavicaDj/received_events",
    "type": "User",
    "site_admin": false
  },
  "committer": {
    "login": "dscho",
    "id": 127790,
    "node_id": "MDQ6VXNlcjEyNzc5MA==",
    "avatar_url": "https://avatars0.githubusercontent.com/u/127790?v=4",
    "gravatar_id": "",
    "url": "https://api.github.com/users/dscho",
    "html_url": "https://github.com/dscho",
    "followers_url": "https://api.github.com/users/dscho/followers",
    "following_url": "https://api.github.com/users/dscho/following{/other_user}",
    "gists_url": "https://api.github.com/users/dscho/gists{/gist_id}",
    "starred_url": "https://api.github.com/users/dscho/starred{/owner}{/repo}",
    "subscriptions_url": "https://api.github.com/users/dscho/subscriptions",
    "organizations_url": "https://api.github.com/users/dscho/orgs",
    "repos_url": "https://api.github.com/users/dscho/repos",
    "events_url": "https://api.github.com/users/dscho/events{/privacy}",
    "received_events_url": "https://api.github.com/users/dscho/received_events",
    "type": "User",
    "site_admin": false
  },
[...]
}

Even if the contributor is not the original author, they should be the committer of the tip commit (i.e. res.committer.login should be equal to pr.author) of the branch they try to contribute (and if they are not a committer, we should probably warn). And in that case, we can get the full name from res.commit.committer.name and the email address from res.commit.committer.email.

We should probably change the data type of IGitGitGadgetOptions.allowedUsers from string[] to something like {[name:string]: { fullName: string, email: string }} and cache the information in the options tracked in refs/notes/gitgitgadget, once obtained.

Activity

  1. webstech commented on Nov 20, 2019

    @webstech
    Contributor

    fyi, it may have been a couple of months ago but allowUsers contained a null entry and a duplicate with a trailing space in the name.

  2. webstech commented on Nov 21, 2019

    @webstech
    Contributor

    We should probably change the data type of IGitGitGadgetOptions.allowedUsers from string[] to something like {[name:string]: { fullName: string, email: string }} and cache the information in the options tracked in refs/notes/gitgitgadget, once obtained.

    Can you clarify what problem this is solving? Are people not receiving emails?

  3. dscho commented on Nov 21, 2019

    @dscho
    MemberAuthor

    We should probably change the data type of IGitGitGadgetOptions.allowedUsers from string[] to something like {[name:string]: { fullName: string, email: string }} and cache the information in the options tracked in refs/notes/gitgitgadget, once obtained.

    Can you clarify what problem this is solving? Are people not receiving emails?

    People who /submit without having a public email address on GitHub indeed do not receive the cover letter, at least.

    Having an email address to work with will also be required for #154.

  4. dscho commented on Nov 21, 2019

    @dscho
    MemberAuthor

    fyi, it may have been a couple of months ago but allowUsers contained a null entry and a duplicate with a trailing space in the name.

    Right. I forgot about the null, I must have done something about the trailing space...

    clicketyclick

    Nope, still there: https://github.com/gitgitgadget/git/blob/53cdae7fc6e490f5a1aeb6d230a62be38fa5232a/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391 (look for "ghedsouza " and for null).

    I should probably edit this manually, shouldn't I ;-)

  5. dscho commented on Nov 21, 2019

    @dscho
    MemberAuthor

    I should probably edit this manually, shouldn't I ;-)

    There. There you go. https://github.com/gitgitgadget/git/blob/e5a0f30cc77/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391

  6. elonderin commented on Jan 6, 2020

    @elonderin

    not quite sure what i need to fix now so that this works and before trying out all possible fixes, i'd rather ask:
    does this fail b/c my committer name != author name or is this is some other problem ?

  7. dscho commented on Jan 6, 2020

    @dscho
    MemberAuthor
  8. mk-pmb commented on Oct 1, 2023

    @mk-pmb

    Whatever we "guess", please make sure users have a very good idea of what personal information exactly will be submitted to the mailing list. Even if European data protection standards may not be mandatory for that list, we should provide that level of respect based on idealism.

    I was rather surprised in git/git#1582 that GitGitGadget seems to have tried to use GitHub profile data rather than the information used in my commit. I would have expected to be warned about that right in the new user welcome message.

    There should not be a direct preview because I wouldn't want to have the bot republish my (potentially not-yet-ready / not intended for GitGitGadget) profile data as an issue comment, but it can report whether my commit From: and Signed-of-by: lines match the data it would use from my profile.

    As an additional benefit in my case, it could have warned me hours earlier that a public GitHub email address is required for using GitGitGadget. If I knew that earlier, I may have already submitted the patch via email. Now due to the delay, it will take a few more days until I will have time to learn how to do that.

  9. mk-pmb commented on Oct 1, 2023

    @mk-pmb

    Not sure if this is worth a new issue: If the author information is unacceptable, it would be nice if GGG could suggest shell commands that I can copy&paste to submit my commit via git-send-email instead.
    It would be acceptable to repeat personal information from the commit in those commands, but I hope there will be no reason to do so, because hopefully git-send-email has options to extract the author information from the HEAD commit anyway. (As above, I didn't yet have opportunity to read about it.)

  10. dscho commented on Oct 1, 2023

    @dscho
    MemberAuthor

    Contributions welcome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions