Skip to content

fix(vscode): list merge commit files - #1029

Merged
lizhengfeng101 merged 1 commit into
alibaba:mainfrom
Wsp030914:fix/vscode-merge-commit-files
Aug 21, 2026
Merged

lizhengfeng101 merged 1 commit into
alibaba:mainfrom
Wsp030914:fix/vscode-merge-commit-files

Conversation

@Wsp030914

@Wsp030914 Wsp030914 commented Aug 21, 2026 •

Copy link
Copy Markdown
Contributor

Description

Fix the VS Code Commit mode pending file list for merge commits.

Problem / Reproduction

Affected scenario

When a user selects a merge commit in the VS Code Open Code Review Sidebar's
Commit mode, the Pending Files list is empty. The user cannot start a review
from that list even though the merge commit contains changes.

Reproduction

Using repository baseline 4b6874b and the existing merge commit 0f0f899:

  1. Run the command currently used by the VS Code adapter:

    git show --name-status --format= 0f0f899

    It produces no file entries because Git uses combined diff output for the
    merge commit by default.

  2. Run the first-parent equivalent:

    git show --diff-merges=first-parent --name-status --format= --end-of-options 0f0f899

    It returns the merge commit's changed files, including:
    README.ja-JP.md, README.ko-KR.md, README.md, README.ru-RU.md,
    README.zh-CN.md, and imgs/logo-core.svg.

The same behavior is visible in VS Code by opening the Sidebar, switching to
Commit mode, selecting 0f0f899, and observing an empty Pending Files list.

Root cause

GitService.getCommitFiles() used Git's default combined diff semantics for
merge commits. The Go core already uses first-parent semantics, and
openDiff() compares a commit with commit^, so the VS Code file list must use
the same contract.

Fix

GitService.getCommitFiles() now uses --diff-merges=first-parent and
--end-of-options, matching the Go core and openDiff() semantics. Ordinary
commit behavior is unchanged.

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Refactoring (no functional changes)
  • Documentation update
  • CI / Build / Tooling

How Has This Been Tested?

  • make test passes locally
  • Manual testing with a deterministic temporary Git repository containing a real --no-ff merge commit

The regression test creates a base commit, diverging feature and main
branches, and a real merge commit. It asserts that
getCommitFiles(mergeSha) returns feature.ts with status added.

Validation completed:

  • extensions/vscode: npm test -- --runInBand — 101 tests passed
  • extensions/vscode: npm run compile
  • make check
  • make test
  • make build
  • ocr review --audience agent — 0 findings

Checklist

  • My code follows the project's coding style (make check passed)
  • I have performed a self-review of my code
  • I have added tests that prove my fix is effective
  • New and existing unit tests pass locally with my changes
  • Documentation update is not applicable
  • I have signed the CLA

Related Issues

Related to #450: the Go core first-parent merge diff fix. This PR aligns the
independent VS Code adapter implementation.

@CLAassistant

CLAassistant commented Aug 21, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@github-actions

Copy link
Copy Markdown
Contributor

✅ OpenCodeReview: Review complete: 0 finding(s) across 1 selected item(s).

@lizhengfeng101 lizhengfeng101 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@lizhengfeng101
lizhengfeng101 merged commit 4d61c97 into alibaba:main Aug 21, 2026
13 checks passed
Githab-capibara added a commit to Githab-capibara/open-code-review that referenced this pull request Sep 17, 2026
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.

4 participants