Incorrect commit shown in event history when a branch was deleted
Summary
Support noticed some odd output while investigating a customer's ticket for a problem on their 13.3.2 self-managed environment.
Issue raised to solicit input into what might have caused this.
Context:
- Feature branch exists
- Merge request opened to merge it to trunk branch
- Additional commit pushed to branch
- Merge request actioned.
- Source branch deleted.
The broader issue is that the trunk branch did not receive the changes.
We verified what we could see in the MR with the event history, using the following query:
p = Project.find_by_full_path('foo/bar/project')
p.events.where(action: "pushed").each do |e|
printf "%-30.30s %-10.10s %s %s %8s...%8s\n", e.push_event_payload[:ref], e.push_event_payload[:action], e.author.try(:username), e.created_at, e.push_event_payload[:commit_from], e.push_event_payload[:commit_to]
end; nil
Example output follows.
Steps to reproduce
No idea how to reproduce it, but here's a simulation of what was seen.
This is what the feature branch looks like locally:
e2a5e2c (HEAD -> moarfeature, origin/moarfeature) add feature23
27b6baa add feature22
7ae71d6 add feature21
e435bf6 add feature20
2bdb4a5 add feature19
d0a750f add feature18
01a5187 add feature17
cfaf826 add feature16
24b0ab0 add feature15
b1a0bb9 (origin/trunk, origin/HEAD, trunk)
The merge request:
The rails query looks like this:
moarfeature created root 2020-09-28 15:21:13 UTC ...24b0ab0623b685617a6da978a7ce81e1f7296584
moarfeature pushed root 2020-09-28 15:21:14 UTC 24b0ab0623b685617a6da978a7ce81e1f7296584...cfaf826b99142d1d10a6e2e2ca45b711f098874b
moarfeature pushed root 2020-09-28 15:21:15 UTC cfaf826b99142d1d10a6e2e2ca45b711f098874b...01a51875a98cc3d5c3246639f98fbef597d907af
moarfeature pushed root 2020-09-28 15:21:18 UTC 01a51875a98cc3d5c3246639f98fbef597d907af...d0a750f27107792cc71a116f4a6a12dc17e58bd4
moarfeature pushed root 2020-09-28 15:21:19 UTC d0a750f27107792cc71a116f4a6a12dc17e58bd4...2bdb4a5fb28ac83a2a98e8d41ae131190951b4af
moarfeature pushed root 2020-09-28 15:21:26 UTC 2bdb4a5fb28ac83a2a98e8d41ae131190951b4af...e435bf6201b9497f4cd1b3d289542005a45b5839
moarfeature pushed root 2020-09-28 15:21:28 UTC e435bf6201b9497f4cd1b3d289542005a45b5839...7ae71d63466a2239b423985b029d5861fac170f7
moarfeature pushed root 2020-09-28 15:21:29 UTC 7ae71d63466a2239b423985b029d5861fac170f7...27b6baa444e5dbc2304091124546437e982b7343
moarfeature pushed root 2020-09-28 15:22:09 UTC 27b6baa444e5dbc2304091124546437e982b7343...e2a5e2c2481cc4585d03cfec7d12306de9d98e55
trunk pushed root 2020-09-28 15:24:43 UTC b1a0bb98bf0854263e0bd184f025e79c4d327a17...37c18d6f1211140eb10a196018a2109533014f01
moarfeature removed root 2020-09-28 15:24:45 UTC e2a5e2c2481cc4585d03cfec7d12306de9d98e55...
From that we can see
- a series of pushes to the feature branch
-
e2a5e2c2481cc4585d03cfec7d12306de9d98e55
finally being pushed to the feature branch (and logged on the MR) -
trunk
being changed by the merge fromb1a0bb98b
to37c18d6f
(the merge commit logged in the MR) - the feature branch being removed, HEAD
e2a5e2c2
All as expected.
The customer's instance logged instead:
moarfeature pushed root 2020-09-28 15:22:09 UTC 27b6baa444e5dbc2304091124546437e982b7343...e2a5e2c2481cc4585d03cfec7d12306de9d98e55
trunk pushed root 2020-09-28 15:24:43 UTC b1a0bb98bf0854263e0bd184f025e79c4d327a17...37c18d6f1211140eb10a196018a2109533014f01
moarfeature removed root 2020-09-28 15:24:45 UTC 2bdb4a5fb28ac83a2a98e8d41ae131190951b4af...
Where 2bdb4a5fb
was the commit from five pushes ago, two days prior to the MR being merged.
Example Project
What is the current bug behavior?
The event entry for the branch being deleted is for an earlier commit.
What is the expected correct behavior?
The event entry for the branch being deleted should show the HEAD commit for the branch.
Relevant logs and/or screenshots
Output of checks
Results of GitLab environment info
Expand for output related to GitLab environment info
(For installations with omnibus-gitlab package run and paste the output of: `sudo gitlab-rake gitlab:env:info`) (For installations from source run and paste the output of: `sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production`)
Results of GitLab application Check
Expand for output related to the GitLab application check
(For installations with omnibus-gitlab package run and paste the output of:
sudo gitlab-rake gitlab:check SANITIZE=true
)(For installations from source run and paste the output of:
sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true
)(we will only investigate if the tests are passing)