Repository navigation
Teach GitGitGadget to guess the full name and email address of new contributors #153
Description
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
webstech commentedon Nov 20, 2019
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.
webstech commentedon Nov 21, 2019
Can you clarify what problem this is solving? Are people not receiving emails?
dscho commentedon Nov 21, 2019
People who
/submitwithout 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.
dscho commentedon Nov 21, 2019
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 fornull).I should probably edit this manually, shouldn't I ;-)
dscho commentedon Nov 21, 2019
There. There you go. https://github.com/gitgitgadget/git/blob/e5a0f30cc77/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391
elonderin commentedon Jan 6, 2020
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 ?
dscho commentedon Jan 6, 2020
@elonderin this is probably all off-topic, but you can edit your full name in this way: https://help.github.com/en/github/setting-up-and-managing-your-github-profile/personalizing-your-profile#changing-your-profile-name
mk-pmb commentedon Oct 1, 2023
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:andSigned-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.
mk-pmb commentedon Oct 1, 2023
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-emailinstead.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-emailhas options to extract the author information from the HEAD commit anyway. (As above, I didn't yet have opportunity to read about it.)dscho commentedon Oct 1, 2023
Contributions welcome!