Make --allow replace an upstream's configured allow-list - #60
Merged
Merged
Conversation
The --allow flags were written as Repositories:{index} configuration keys,
and configuration merges arrays by index. A flag therefore replaced only the
first entries of a list from --config, appsettings.json or the environment:
config ["studio/game.git", "studio/tools.git"] plus
--allow github=studio/engine.git bound ["studio/engine.git",
"studio/tools.git"], silently dropping studio/game.git.
The flags are now grouped per upstream and assigned in a post-configure step,
so an upstream named by --allow allows exactly the flag patterns. Upstreams no
flag names keep their configured list. This matches ktsu.GitLfsCache, and the
--allow help text and README now say so.
Fixes #46
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015LsGhhi4Vq9pNq2fr5T75T
|
This was referenced Sep 29, 2026
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 #46
Problem
--allowwas written asRepositories:{index}configuration keys. Configuration merges arrays by index, so when it was combined with--configa flag overwrote only the file's first entries. For example, a file withstudio/game.git, studio/tools.gitplus--allow github=studio/engine.gitboundstudio/engine.git, studio/tools.git.studio/game.gitwas dropped without any message.Change
This implements the maintainer's decision on the issue (replace, not append), in the same way ktsu-dev/GitLfsCache#67 did for the sibling tool:
TryParseAllowsgroups the flags by upstream. It is case-insensitive and keeps the order the flags were typed in.ReplaceAllowListsruns as aPostConfigure<GitBranchStateCacheOptions>. It sets each named upstream'sRepositoriesto exactly the flag patterns. Upstreams that no flag names keep their configured list. An upstream that only a flag names is created.--allowhelp text and the README now describe the replace behaviour.Tests
GitBranchStateCache.Tests/Tool/AllowFlagTests.cs, with the test project now referencing the Tool project. It covers the acceptance case (N configured entries plus M flags gives exactly M), repeated flags, other upstreams left untouched, an unconfigured upstream, no flags at all, and malformed entries.ReplaceAllowListsfor the old merge-by-index behaviour.Allow_FewerPatternsThanConfigured_ReplacesTheConfiguredListfailed, and it passes with the fix.dotnet test GitBranchStateCache.slnx).🤖 Generated with Claude Code
https://claude.ai/code/session_015LsGhhi4Vq9pNq2fr5T75T
Generated by Claude Code