Unreachable commit notified by webhook cannot be retrieved
Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.
Summary
Gitlab's integrated Webhook feature sends Push Event notification with unreachable commit.
Description
Typically after a rebase, amend or other action that requires a force push we can have dangled commits. Such "dereferenced" commits are getting lost due to git gc that may be executed internally or by using GitLab Housekeeping features.
When using Webhook for Push Events, the system will use the sha1 sent in the previous Push Event notification as being the "before" reference. This would be ok if a fetch on this reference is possible, but GitLab seems to do so housecleaning under cover and the referenced commit cannot be retrieved.
Steps to reproduce
- Create a Push Event notification using Webhook
- commit and push something to a branch (say we have commit A)
- commit and push something again to get commit B (the notification sent will reference a valid/reachable sha1 in the "before" field)
- amend commit A (e.g.: commit log) to get A' and force push
- Observe notification sent: the before field references commit A but it cannot be fetched!
Expected behavior(s)
Two possible cases:
- GitLab notify the Push Event with commit A'
- Gitlab notify the Push Event with commit A but
git fetch origin Amust work.
Gitlab information
We use Gitlab v11.2.5-ee (da87da28) with Premium plan