Repository navigation
fix(config): reject vars keys git would lowercase or refuse - #4830
Merged
Merged
Conversation
Git stores config variable names lowercased, so `wt config state vars set
Ticket=ABC` reported success while templates referencing {{ vars.Ticket }}
rendered empty (the value reads back as `ticket`). A key starting with a
digit passed validation and then failed with git's bare "invalid key".
validate_vars_key now requires a lowercase first letter followed by
lowercase letters, digits, and hyphens, and the help text says so.
1 task
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.
wt config state vars set Ticket=ABCprinted "Set Ticket for main", but git stores config variable names lowercased, so the value reads back asticket. A hook or custom column that references{{ vars.Ticket }}renders empty, andvars list/state getshow a different key than the one that was set. A key that starts with a digit (1st=…) passed validation and then failed with git's bareerror: invalid key.validate_vars_keynow requires a lowercase first letter followed by lowercase letters, digits, and hyphens, which is the subset git stores verbatim. Thevarshelp text and its generated doc mirrors say so.Interface note: the validator is shared by
set,get, andclear, sovars get Ticketandvars clear Ticketnow error too, where before git's case-insensitive lookup let them match the storedticket. No stored key can contain uppercase, so the lowercase spelling always works. Lowercasing input onsetwould be the alternative if keeping existing scripts that pass mixed-case keys working matters more than a clear failure. Neither choice fixes a template that already spells the key in mixed case.Found by the nightly survey of
src/commands/config/state.rs. The newtest_vars_set_rejects_keys_git_cannot_store_verbatim(uppercase and leading-digit cases) failed before the change and passes after it. The existing invalid-key snapshot andtest_docs_are_in_syncare updated.