Skip to content

Recognise "no changes added to commit" as nothing to commit [patch] - #199

Merged
matt-edmondson merged 2 commits into
mainfrom
fix/194-no-changes-added-to-commit
Oct 9, 2026
Merged

matt-edmondson merged 2 commits into
mainfrom
fix/194-no-changes-added-to-commit

Conversation

@matt-edmondson

Copy link
Copy Markdown
Contributor

Fixes #194

What changed

When tracked files are modified but nothing is staged, git commit prints no changes added to commit. GitCommitBuilder.CreateException only looked for nothing to commit and nothing added to commit, so this case, the most common one, came back as a generic GitCommandException rather than a GitNothingToCommitException.

  • GitIntegration/Builders/GitCommitBuilder.cs: CreateException now matches the third phrasing too, and the remarks list all three phrasings.
  • GitIntegration.Test/Builders/GitCommitBuilderTests.cs: added ThrowsNothingToCommitWhenTrackedChangesAreUnstagedAsync, a scripted-runner test using the stdout git produces in this case (exit code 1).

Verification

  • With the fix reverted, the new test fails: Expected exception of exact type GitNothingToCommitException but caught GitCommandException. With the fix, it passes.
  • Full suite on Linux (.NET 10): 765 passed, 0 failed.

🤖 Generated with Claude Code

https://claude.ai/code/session_016n29aex51pHZeVj2vx831E


Generated by Claude Code

claude added 2 commits October 9, 2026 00:25
Committing with tracked files modified but nothing staged makes git print
"no changes added to commit", which matched neither phrase CreateException
looked for, so the commonest nothing-to-commit case surfaced as a generic
GitCommandException. Match the third phrasing too, list all three in the
remarks, and pin it with a scripted-runner test.

Fixes #194

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016n29aex51pHZeVj2vx831E
@sonarqubecloud

sonarqubecloud Bot commented Oct 9, 2026

Copy link
Copy Markdown

@matt-edmondson
matt-edmondson merged commit 1371317 into main Oct 9, 2026
16 checks passed
@matt-edmondson
matt-edmondson deleted the fix/194-no-changes-added-to-commit branch October 9, 2026 07:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants