- It's possible to hide your contribution graph and not be searchable on
GitHub. Let's make sure `brew contributions` doesn't fall over if the
user's profile is private (determined by the `/events` user endpoint
returning []).
- I'm not as happy with this as I was with my work on `utils/tty.rb`,
it feels a lot hackier and prone to breaking - especially the
`T.nilable` "detection".
- However, it generates an RBI file that passes `brew typecheck`, so we
can clean up some `hidden-definitions` entries, getting further
towards fully typed.
Now both REPL history is written to $HOME.
- Pry: $HOME/.brew_pry_history
- IRB: $HOME/.brew_irb_history
The IRB config file has also been moved to the
library directory.
The idea here is that the pry session history
should be separate for homebrew than the global
pry history.
We also ignore any .pryrc files so that they
don't interfere with this config.
- I needed to add some more `require`s to the `tty.rb` generator script
since it failed to recognise `env_config` and Sorbet's `T` setup if I
ran it not via `brew ruby`, and I couldn't get `brew ruby` to work
within `safe_system` in the `typecheck` dev-cmd.
- The usage of this in `brew contributions` wasn't correct for a user
with 5 authored commits to homebrew/cask that had been committed by
other people, the numbers would turn out as 5 authored, 5 committed.
- I decided to do this properly by getting the SHAs for author and
committer and determine the differences between the two arrays.
This also accounts for when authored commits are 0, or committed
commits, or both.
- Add tests, because I don't want to fix this a third time!
- For a situation where `authored = 3`, `committed = 4`, the previous
calculation was `3 - 4` which meant that `committed = -1` in the end.
- This was incorrect, since a user can't have negative contributions!
- Instead, only do the subtraction to get the deduplicated `committed`
count if the number of authored commits is higher than the number of
committed commits. This approach should achieve the desired "don't
double count things that the user authored and committed, but do count
things that another person authored that the user committed".
- Double counting is artificially inflating folks' contributions (sadly ;-)).
- Since I'm not going to enumerate every possible author to filter by *both*
fields via the API, let's do some arithmetic to figure out the unique
committer numbers for a user.
- The GitHub list commits API now supports this filtering
(https://docs.github.com/en/rest/commits/commits?apiVersion=2022-11-28#list-commits--parameters),
because I wrote it. :-)
- Authoring a commit and committing a commit are two separate concepts: author
is the person who wrote the code and, in old parlance, the committer is the
person who applied the patch (remember when we sent patches to mailing lists?).
- In practice for us in Homebrew, this occurs when we make a change in GitHub's
web editor, or, more obviously, when BrewTestBot pushes `homebrew-core`
commits from users (then, `BrewTestBot` is the `committer`).