Repository navigation
Refuse an Add with nothing to stage, or with both All and UpdateTrackedOnly [patch] - #213
Open
matt-edmondson wants to merge 1 commit into
Open
matt-edmondson wants to merge 1 commit into
matt-edmondson wants to merge 1 commit into
Conversation
…edOnly [patch] A bare Add() ran "git add" with no pathspec, which prints "Nothing specified, nothing added." and exits 0, so the builder reported success having staged nothing. All() with UpdateTrackedOnly() reached git as "options '-A' and '-u' cannot be used together" (exit 128). Both now throw InvalidOperationException before a process is spawned, matching the Fetch and Checkout guards. The pathspec-failure test now sets the path it simulates, and the mutating-verb scoping test stages with All(). Fixes #172 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BkmjSwCY4KW87X2ccQhj7T
|
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 #172
What changed
GitAddBuilder.AppendVerbArgumentsnow refuses two configurations before any process is spawned. It uses the same guard pattern asGitFetchBuilder(AllRemotes+FromRemote) andGitCheckoutBuilder(#91).ForPath,AllorUpdateTrackedOnlywas called. A baregit addprintsNothing specified, nothing added.and exits 0, so the builder used to report success having staged nothing. It now throwsInvalidOperationException.All()+UpdateTrackedOnly(). git rejects this withfatal: options '-A' and '-u' cannot be used together(exit 128), which doesn't name either of the calls that caused it. It now throwsInvalidOperationExceptionwith a message that does.TryExecuteAsyncbuilds the arguments before it runs anything, so both entry points throw the same way. The interface remarks onForPath,AllandUpdateTrackedOnlydescribe the requirement.Tests
RejectsAnAddWithNothingToStage,RejectsAskingForBothAllAndUpdateTrackedOnly, andRefusesAnAddWithNothingToStageBeforeRunningGitAsync. The last one goes throughTryExecuteAsyncand asserts that the runner was never called.BuildsTheDefaultAddVectorused to pin the bare vector, which is now refused. It is nowBuildsTheAllAddVector, which pinsadd --all. TheForPath,AllandUpdateTrackedOnlyvectors used on their own are unchanged.ExecuteThrowsWhenAPathspecMatchesNothingAsyncsimulates a pathspec failure but never set a path. It now callsForPath("no/such/file.txt"), the path it describes.GitRepositoryMutatingVerbTests.EveryMutatingVerbIsScopedToTheRepositoryPathnow callsAdd().All(), as the issue asked.KTSU_GIT_INTEGRATION_TESTS_REQUIRED=1: 803 of 803 passed.🤖 Generated with Claude Code
https://claude.ai/code/session_01BkmjSwCY4KW87X2ccQhj7T
Generated by Claude Code