Skip to content

Fix GitLab squash merge misclassification when squash_commit_sha is null - #2149

Open
jaivardhan-bhola wants to merge 2 commits into
git-ai-project:mainfrom
jaivardhan-bhola:gitlab-squash-bug
Open

Fix GitLab squash merge misclassification when squash_commit_sha is null #2149
jaivardhan-bhola wants to merge 2 commits into
git-ai-project:mainfrom
jaivardhan-bhola:gitlab-squash-bug

Conversation

@jaivardhan-bhola

@jaivardhan-bhola jaivardhan-bhola commented Aug 13, 2026

Copy link
Copy Markdown

Issue

GitLab issue #2079 - When GitLab returns squash: true without squash_commit_sha (older self-managed instances like GitLab 12.4.2), the squash commit's authorship is lost because the code falls back to the outer merge commit which has two parents and gets classified as a "simple merge"

Changes

  • Added validate_squash_candidate() function that infers the squash commit from merge commit parents by tree matching
  • Added fallback path in get_gitlab_ci_context() that attempts to infer the squash commit when squash_commit_sha is null
  • Added 4 new test cases: valid squash candidate, reversed parent order, non-merge rejection, tree mismatch rejection
    Behavior: When squash: true and squash_commit_sha: null, the code now attempts to identify the generated squash commit S from the merge commit's parents. If successful, authorship is preserved for S. If not, a warning is emitted and the existing fallback is used.

Open in Devin Review

@CLAassistant

CLAassistant commented Aug 13, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

devin-ai-integration[bot]

This comment was marked as resolved.

@jaivardhan-bhola

jaivardhan-bhola commented Aug 13, 2026

Copy link
Copy Markdown
Author

@svarlamov please review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants