Repository navigation
fix: Windows remembers its repositories and its profiles - #11
Merged
Merged
Conversation
The home folder was asked for in nine places and not the same way in each. The settings looked for HOME and then USERPROFILE; the list of known repositories and the profiles looked for HOME and stopped. A Windows program started from the desktop has no HOME, so there the settings were written and the other two never were, and nothing said so -- a file with nowhere to go is deliberately not an error. It is asked in one place now, home.rs, and everything goes through it: the three files, a profile's key written with a tilde, where a new key would be made, known_hosts and the SSH config, the folder a clone starts beside and the one the key chooser opens in. The files stay under .config in the home folder on Windows rather than moving to %APPDATA%: the settings were already there. Read out of the code and not seen on Windows. The two new tests hand the variables in instead of setting them, so what they prove is the rule and not the machine. Signed-off-by: Francesc <francesc.bagur@coffeesoftware.io> Co-Authored-By: Claude <noreply@anthropic.com>
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.
What this changes
On Windows the list of known repositories and the profiles are now written and read. Until now they were not: both looked for
HOMEand nothing else, and a Windows program started from the desktop has noHOME. The settings were fine, because they alone also looked forUSERPROFILE.What was decided
home.rshasfolder()--HOME, elseUSERPROFILE, and a variable set to nothing counts as not set -- andconfig(). Patching the twofile()functions that were wrong would have left seven other lookups, each free to be wrong next. Four of them were, more quietly: a profile's key written as~/...did not resolve, a new key had nowhere to be made, a clone had no folder to start beside, and the key chooser opened wherever it liked.HOMEstill goes first, on Windows too. That is the order the settings and the SSH code already used. It is only set there when something set it -- Git Bash does -- and changing the order now would move the settings file of anybody in that position..config\gitrustunder the home folder, not%APPDATA%.%APPDATA%is the custom on Windows. The settings were already being written under.config, and three files in one folder beat two folders with one of them in the proper place. Moving all three is a migration, and it is not this fix.SECURITY.mdalready says what protects it there: the folder's own permissions, and nothing this program does.Checked
cargo testpasses here, not just in CI -- 382, two of them new. They hand the variables in rather than setting them: the environment belongs to the whole test process.git commit -s) and read as sentences🤖 Generated with Claude Code