Unexpectedly Merged Commits from Divergent Branch History Not Triggering Gerrit Reviews

13 views
Skip to first unread message

卞姗姗

unread,
Sep 24, 2025, 7:15:30 AM (2 days ago) Sep 24
to Repo and Gerrit Discussion

My Gerrit version is Gerrit 3.10.8, and I’m encountering the following issue:
Background:

  • There is a main branch with commit history: commitid1commitid2commitid3commitid4commitid5.
  • I created a new branch dev based on an older commit commitid2.

Scenario:

  1. I downloaded the main branch code from Gerrit and made modifications on the latest commit commitid5, resulting in a new commit commitid6.
  2. I submitted this change (commitid6) to the dev branch for code review.
  3. After successful review, I clicked "Submit" to merge it into dev.

Observation:

  • The dev branch now contains all commits: commitid1commitid2commitid3commitid4commitid5commitid6.
  • However, when pushing to Gerrit for review, only one Gerrit change (for commitid6) was generated. There were no prompts or Gerrit entries for commitid3commitid4, or commitid5.
  • Using git reflog -b dev in the Gerrit repository shows only two entries:
    • Branch creation (from commitid2).
    • Merge of commitid6.
  • Meanwhile, git log -b dev displays all six commits.
  • Cloning the dev branch locally also shows all six commits.

Questions:

  1. Why does Gerrit not generate prompts or corresponding Gerrit Change-IDs for the included commits (commitid3commitid4commitid5)?
  2. Does Gerrit intentionally allow such operations without validation, and are there plans to optimize this behavior in future updates?

Thank you for your time and guidance. Looking forward to your insights on this behavior.

Matthias Sohn

unread,
Sep 24, 2025, 7:48:12 AM (2 days ago) Sep 24
to 卞姗姗, Repo and Gerrit Discussion
On Wed, Sep 24, 2025 at 1:15 PM 卞姗姗 <bianshan...@gmail.com> wrote:

My Gerrit version is Gerrit 3.10.8, and I’m encountering the following issue:
Background:

  • There is a main branch with commit history: commitid1commitid2commitid3commitid4commitid5.
  • I created a new branch dev based on an older commit commitid2.

Scenario:

  1. I downloaded the main branch code from Gerrit and made modifications on the latest commit commitid5, resulting in a new commit commitid6.
  2. I submitted this change (commitid6) to the dev branch for code review.
you can reject such pushes for the wrong branch by setting
receive.rejectImplicitMerges = true
in project.config of All-Projects on the refs/meta/config branch
This can be done from the Gerrit UI at https://your.gerrit.host/admin/repos/All-Projects,general
There the option is named "Reject implicit merges when changes are pushed for review".

 
  1. After successful review, I clicked "Submit" to merge it into dev.

Observation:

  • The dev branch now contains all commits: commitid1commitid2commitid3commitid4commitid5commitid6.
  • However, when pushing to Gerrit for review, only one Gerrit change (for commitid6) was generated. There were no prompts or Gerrit entries for commitid3commitid4, or commitid5.
  • Using git reflog -b dev in the Gerrit repository shows only two entries:
    • Branch creation (from commitid2).
    • Merge of commitid6.
  • Meanwhile, git log -b dev displays all six commits.
  • Cloning the dev branch locally also shows all six commits.

Questions:

  1. Why does Gerrit not generate prompts or corresponding Gerrit Change-IDs for the included commits (commitid3commitid4commitid5)?
  2. Does Gerrit intentionally allow such operations without validation, and are there plans to optimize this behavior in future updates?

Thank you for your time and guidance. Looking forward to your insights on this behavior.

--
--
To unsubscribe, email repo-discuss...@googlegroups.com
More info at http://groups.google.com/group/repo-discuss?hl=en

---
You received this message because you are subscribed to the Google Groups "Repo and Gerrit Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to repo-discuss...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/repo-discuss/18c9d966-a855-460d-a617-6c306a681ba6n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages