Credit Where Credit Is Due

Every source file in the Swift project contains license and copyright preamble that says:

See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors

That file claims that it is automatically generated:

Auto-populated List

Names below this line are automatically generated from the repository logs. It contains the information about the committer that was publicly present when the commit was made.

But it appears that the process that maintains the contributors list isn’t automated and wasn’t executed for several years: CONTRIBUTORS.txt contains 221 individuals (including duplicates), whereas the GitHub says that Swift project has 581 contributors.

Can this process be automated, or at least executed regularly, and update the list of contributors to reflect all the hard work the community has poured in?

2 Likes

I will look into what the state of the automation is.

2 Likes

The CONTRIBUTORS file is something I was going to suggest we remove because it has problems being kept up-to-date and that all this information can be queried from GitHub. Before we made that switch I wanted to make sure the affordances provided by GutHub are adequate so that we don’t have the same problem of not appropriately crediting people. It’s been on my list of TODOs.

2 Likes

Does that mean we’ll update the file preamble to link to the Github for copyright purposes?

Yes, and everywhere else that references that file... assuming we deem that adequate for serving the same purpose that ostensibly the CONTRIBUTORS file serves.

Well, I for one, don’t know how to get more than the list of top100 contributors from that github listing, and that doesn’t seem sufficient from copyright perspective… maybe someone from legal should have a look at that, too?

Yeah, this is my concern. If GitHub does not have a good way to do what we need we will keep the CONTRIBUTORS file.

You can use 'shortlog' in git to list everyone that has made a contribution via git, e.g.:

git shortlog -s -e --no-merges

We could introduce a .mailmap file as well to clean up this output for people that have contributed under multiple email addresses but only want a single current canonical one to show up in the output.

1 Like

That's super cool—I'd not seen a .mailmap file before! I took a crack at creating one, using a best guess at consolidating email addresses, in which I've probably made some mistakes:

https://github.com/apple/swift/compare/master...natecook1000:add-mailmap

With that in place, generating the list with the command below produces 653 names instead of the default 795:

git shortlog -s -e --no-merges | cut -f 2 | sed -E 's/^/- /' | sort -f

I really like that people could simply update that file to switch their own contact/name information.

1 Like

@nnnnnnnn This looks great. Can you create a pull request? I've noticed a few cases of replicated names (e.g., "Dave Abrahams" is listed on 4 consecutive rows). I think adding this would be great.

This also looks great. I'd be happy to use this to update the CONTRIBUTORS file, once we have a good mailmap landed.

1 Like

Yep! PR here: Add .mailmap file to merge email addresses in git shortlog by natecook1000 · Pull Request #15958 · apple/swift · GitHub

2 Likes

Neat-o!

FYI – If one always wants to use the mailmap with log-like operations (including git blame), then set log.mailmap to true in the desired git configuration file. For example, to change ~/.gitconfig, one can run git config --global log.mailmap true