Repository navigation
fix: the config has an entry only for a repository with a shared path - #20
Merged
Merged
Conversation
wt init wrote an entry with an empty list for each repository, so the config listed each repository and only some of them had a path. The entry told wt share and wt sync that wt init ran. No other command read it, and the hook and wt ls read an empty entry as no entry. wt init now writes nothing to the config, and the store tells that it ran. wt ignores an entry with an empty list, and it does not write one. Two keys that differ only in case are refused only when both have a path: an empty entry loses nothing.
wt init no longer read the key, so it made the store and the hook in a repository with no origin. is_managed reads the store, so the hook then failed at each new worktree, and wt sync and wt ls failed too: each one finds the shared paths by the URL of origin. wt init now reads the key before it writes anything. It also installs the hook before it makes the store. A hook that wt cannot install then leaves the repository unmanaged, and not managed with no hook.
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 initwrote an entry with an empty list for each repository. My config has 16 entries, and onlydespesashas a path. The empty entry only toldwt shareandwt syncthatwt initran.wt add,wt cd,wt delete,wt pruneandwt clonedo not read the config, and the hook andwt lsread an empty entry as no entry.wt initwrites nothing to the config.wt shareadds the entry with the first path.Repo::is_managedreads the store,<common>/shared/, and not the config.wt initmakes the store, so each repository that an olderwt initset up stays managed. It returnsboolnow, bc it reads no config and needs no origin. luneta does not call it.wtignores an entry with an empty list when it reads the config, and it does not write one. A file from an olderwt initloses its empty entries at the nextwt share.wt sharemakes the entry before it tries each path, so a call where each path failed also wrote an empty entry before.lorenzolfm/Florestaandlorenzolfm/floresta, both empty, and 0.3.0 refuses it, so the hook and each command that reads the config fail in each repository.wt lsshows the links when the config has a path, as before. It no longer also asksis_managed, which was always true when the list had a path.wt --helpand the fish completion no longer say thatwt initmakes a config entry.wt initno longer needs origin.wt sharestill does, for the key.A repository that
wt initdid not set up, for example a plaingit cloneon a new machine whose dotfiles have its entry, now getsrun wt init firstfromwt shareandwt sync. Before,wt shareran there with no hook, so a new worktree got no links.An older
wton a different machine that shares the config reads a repository with no entry the same way: itswt shareandwt syncsay to runwt init. Thatwt initadds an empty entry again, and thiswtignores it.Test
The four CI gates (
nix build .#wt .#wt-clippy .#wt-test .#wt-fmt) pass.cargo testruns 71 tests.owner/Floresta = [],owner/floresta = [".env"]andowner/wt = []. It has one entry,owner/florestawith.env. Before, it was refused.repo_mutbeside an entry with a path. The file has the second one only. Before, it had both.A manual test with
XDG_CONFIG_HOMEon a copy of my config:wt lsin this repository, with wt 0.3.0github.com/lorenzolfm/Floresta and github.com/lorenzolfm/floresta are the same repositorywt lsin this repository, with this branchwt clone <path> projwt share .envinproj/mainprojwith.env, anddespesas. The 15 empty entries are gone.wt add feature.env.wt lsgives1/1 linksfor both worktrees.