Skip to content

fix: Windows remembers its repositories and its profiles - #11

Merged
FrancescBagur merged 1 commit into
masterfrom
fix/windows-home
Nov 12, 2026
Merged

FrancescBagur merged 1 commit into
masterfrom
fix/windows-home

Conversation

@FrancescBagur

Copy link
Copy Markdown
Owner

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 HOME and nothing else, and a Windows program started from the desktop has no HOME. The settings were fine, because they alone also looked for USERPROFILE.

What was decided

  • One place asks, not nine. home.rs has folder() -- HOME, else USERPROFILE, and a variable set to nothing counts as not set -- and config(). Patching the two file() 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.
  • HOME still 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\gitrust under 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.
  • Something that is newly true and worth knowing: a profile's token can now be on disk on Windows, where it could not be before because the file was never written. SECURITY.md already says what protects it there: the folder's own permissions, and nothing this program does.

Checked

  • cargo test passes 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.
  • It was run -- not on Windows, which is the only place it matters. It was read out of the code after a run on Windows showed everything else working. On Linux nothing changes, and the suite says so.
  • Anything that writes (index, stash, branches, remote) or touches the graph layout carries a test -- none of that is touched
  • Commits are signed off (git commit -s) and read as sentences

🤖 Generated with Claude Code

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>
@FrancescBagur
FrancescBagur merged commit df9bfdc into master Nov 12, 2026
7 checks passed
@FrancescBagur
FrancescBagur deleted the fix/windows-home branch November 12, 2026 06:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant