Repository navigation
Recognise "no changes added to commit" as nothing to commit [patch] - #199
Merged
Merged
Conversation
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
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Fixes #194
What changed
When tracked files are modified but nothing is staged,
git commitprintsno changes added to commit.GitCommitBuilder.CreateExceptiononly looked fornothing to commitandnothing added to commit, so this case, the most common one, came back as a genericGitCommandExceptionrather than aGitNothingToCommitException.GitIntegration/Builders/GitCommitBuilder.cs:CreateExceptionnow matches the third phrasing too, and the remarks list all three phrasings.GitIntegration.Test/Builders/GitCommitBuilderTests.cs: addedThrowsNothingToCommitWhenTrackedChangesAreUnstagedAsync, a scripted-runner test using the stdout git produces in this case (exit code 1).Verification
Expected exception of exact type GitNothingToCommitException but caught GitCommandException. With the fix, it passes.🤖 Generated with Claude Code
https://claude.ai/code/session_016n29aex51pHZeVj2vx831E
Generated by Claude Code