Looking through the github API, the PushEvents category includes a list of commits and a github assigned time when the event happened. The PushEvent description documentation claims the attribute commits[][distinct] indicates
Whether this commit is distinct from any that have been pushed before.
This would suggest there is only one event entry where a commit is marked with the 'distinct' flag set to True as the earliest time Github saw them, and that such event would have the earliest timestamp compared to any other event that also has that commit.
However, I have found that some commits get marked 'distinct' in multiple different push event notifications, and that commits flagged with 'distinct' = False may actually show up in earlier events than those events where they were marked 'True'.
Why is that? am I misunderstanding the meaning of the 'distinct' flag?
Even thought I never worked with Webhooks before the documentation doesn't confuse me.
For example I can totally see why you could get multiple distinct commits. Say you create a bugfix branch off the main branch and do three commits:
* 5ad1d361 (bugfix) Dolor
* ec656d67 Ipsum
* 9879ac57 Lorem
/
* 655a19cd (main) Baz
* ccc62669 Bar
* 48158120 Foo
When you push the bugfix branch to your GitHub remote then GitHub never saw these three commits before so mark all of them as distinct. (If you push another commit then only that last commit should be marked as distinct.)
However I can see potential for confusion when you rebase branches.
Say you push a new commit to your main branch:
* 728bae2c (main) Bat
| * 5ad1d361 (bugfix) Dolor
| * ec656d67 Ipsum
| * 9879ac57 Lorem
| /
* 655a19cd Baz
* ccc62669 Bar
* 48158120 Foo
Then you rebase your bugfix branch against main. You now have:
* 54116c88 (bugfix) Dolor
* 09ac9aba Ipsum
* 7dc89c8e Lorem
/
* 728bae2c (main) Bat
* 655a19cd Baz
* ccc62669 Bar
* 48158120 Foo
When you push bugfix to your GitHub remote I wouldn't be surprised to hear that the three commits are now marked as distinct again. Even thought they didn't change and are technically older than 728bae2c, they have been rebased and their commit hash has changed so they are new commits as far as GitHub is concerned.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With