Skip to content

Show why Cmd+Enter did not commit#54

Merged
GordonBeeming merged 4 commits into
mainfrom
gb/commit-hint
Jul 10, 2026
Merged

Show why Cmd+Enter did not commit#54
GordonBeeming merged 4 commits into
mainfrom
gb/commit-hint

Conversation

@GordonBeeming

@GordonBeeming GordonBeeming commented Jul 10, 2026

Copy link
Copy Markdown
Owner

Summary

  • Pressing Cmd/Ctrl+Enter in the commit message box with no files ticked (or an empty message) used to do nothing, which reads as "committing is broken". The Commit button disables itself in those states, but the keyboard path had no feedback at all.
  • The shortcut now surfaces a small warning notice in the same slot as the "Committed…" success line — "Select at least one file to commit." or "Enter a commit message first." — with the amber warning styling. It clears the moment the message or the file selection changes.
  • Also removes a dead .commit-panel__sync-conflicts CSS rule left over from the old conflict UI (kept the CSS budget green).

Test plan

  • npm test — 403 passing (new coverage: hint shows for no-selection and empty-message, clears when the selection changes)
  • npx tsc --noEmit, npm run build, npm run budget, npm run smoke, npm run theme:check

Summary by CodeRabbit

  • Bug Fixes
    • Improved commit-panel Cmd/Ctrl+Enter handling by showing warning notices when required preconditions aren’t met (no files selected or empty commit message).
    • Warnings now auto-dismiss when input becomes valid and are cleared when leaving commit mode.
  • Tests
    • Added a UI test covering Cmd/Ctrl+Enter behavior, including hint display and dismissal for invalid vs. valid commit inputs.
  • Style
    • Added warning-specific styling for commit-panel notices and updated sync-conflict notice styling to match the new UI.

@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Changes

Git commit feedback

Layer / File(s) Summary
Commit validation and warning display
src/App.tsx, src/styles.css
Commit attempts show hints for missing file selections or commit messages, clear hints when inputs or commit mode change, and render a warning notice.
Commit validation coverage
src/App.test.tsx
The Git commit sidebar test covers file-selection and whitespace-only message validation.

Sync conflict styling

Layer / File(s) Summary
Sync conflict style removal
src/styles.css
Removes the existing container and list-item styling for sync conflicts.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: adding feedback for why Cmd+Enter/Ctrl+Enter may not commit.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch gb/commit-hint

Comment @coderabbitai help to get the list of available commands.

@GordonBeeming GordonBeeming marked this pull request as ready for review July 10, 2026 15:24
Copilot AI review requested due to automatic review settings July 10, 2026 15:24

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a visual hint in the Git commit panel to explain why a commit action (such as Cmd+Enter) did nothing when there are no selected files or when the commit message is empty. It also adds a corresponding test and styling for the warning notice. Feedback on the changes points out that using gitCommitSelectedPaths (a Set) in the useEffect dependency array will cause the hint to be prematurely cleared during background status polls because the set reference changes. It is recommended to serialize the selected paths to prevent this issue.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread src/App.tsx Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR improves the Git commit sidebar UX by providing explicit feedback when users press Cmd/Ctrl+Enter in the commit message box but a commit cannot proceed (no selected files or empty message), aligning the keyboard shortcut path with the disabled Commit button behavior.

Changes:

  • Adds a new “warning” notice style and renders a hint message when Cmd/Ctrl+Enter is pressed but commit preconditions aren’t met.
  • Clears the hint when the commit message or file selection changes.
  • Adds test coverage for the new hint behavior and removes a dead CSS rule from the old conflict UI.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
src/styles.css Adds warning notice styling and removes unused .commit-panel__sync-conflicts rules.
src/App.tsx Introduces gitCommitHint, sets it on invalid shortcut commit attempts, and renders a warning notice in the commit panel.
src/App.test.tsx Adds a regression test ensuring the hint appears for invalid shortcut commits and clears after user action.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/App.tsx Outdated
Comment thread src/App.tsx

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
src/App.test.tsx (1)

4714-4718: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Cover clearing after the commit message changes.

The test verifies clearing after file selection changes, but not after a visible message hint is followed by a valid message. Add an assertion that changing " " to a non-whitespace message removes "Enter a commit message first.".

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/App.test.tsx` around lines 4714 - 4718, Extend the relevant test in
App.test.tsx after the existing visible hint assertion: change the message from
whitespace to a valid non-whitespace commit message, then assert that “Enter a
commit message first.” is no longer present in the panel. Keep the existing
file-selection clearing coverage intact.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/App.tsx`:
- Around line 1658-1662: Update the effect that clears gitCommitHint to depend
on a stable, order-independent signature of gitCommitSelectedPaths, such as
sorted joined paths, instead of the Set object identity; alternatively, make
refreshGitStatus preserve the existing Set when members are unchanged. Keep
gitCommitMessage as a dependency so the hint still clears on message edits.

---

Nitpick comments:
In `@src/App.test.tsx`:
- Around line 4714-4718: Extend the relevant test in App.test.tsx after the
existing visible hint assertion: change the message from whitespace to a valid
non-whitespace commit message, then assert that “Enter a commit message first.”
is no longer present in the panel. Keep the existing file-selection clearing
coverage intact.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 252a292a-8dc0-4c01-9fd7-dc220a53d49c

📥 Commits

Reviewing files that changed from the base of the PR and between b2e1dca and 4f41abd.

📒 Files selected for processing (3)
  • src/App.test.tsx
  • src/App.tsx
  • src/styles.css

Comment thread src/App.tsx Outdated
Address reviewer comments:
- clear the commit hint on semantic selection changes, not Set identity
- clear stale success/error lines when a precondition shows the hint
Copilot AI review requested due to automatic review settings July 10, 2026 15:36

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

Comment thread src/App.tsx
Comment thread src/App.test.tsx
Address reviewer comments:
- clear the commit hint when the commit panel closes
- assert the hint clears after editing the message
Copilot AI review requested due to automatic review settings July 10, 2026 15:52

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

Comment thread src/App.test.tsx Outdated
Copilot AI review requested due to automatic review settings July 10, 2026 16:02

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

Comment thread src/App.tsx
@GordonBeeming GordonBeeming merged commit fa7e988 into main Jul 10, 2026
5 of 7 checks passed
@GordonBeeming GordonBeeming deleted the gb/commit-hint branch July 10, 2026 16:30
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