3.3 KiB
spec, blocked-by
| spec | blocked-by |
|---|---|
| dot-setup-folders | 0011-folders-unconditional-merge |
What to build
Stop reading the short-name target from ~/.config/user-dirs.dirs and
hardcode the legacy-name -> short-name mapping directly in
_dot_setup_folders, dropping the dependency on that file entirely.
The original design treated the tracked user-dirs.dirs as the single
source of truth for target names, assuming someone would hand-edit it to
the short names before ever running the command. On this machine that
never happened: the tracked file still had the stock XDG defaults
(XDG_DOCUMENTS_DIR="$HOME/Documents", etc.), so target_path resolved to
the exact same directory as legacy_path for every folder. The migration
logic then reported every entry as a "collision" against itself instead of
moving anything -- a confusing, silent-feeling failure rather than an
actual migration.
The short names are fixed (.desktop, doc, dwn, mus, pic, vid,
.ignoreme) and not meant to be configurable, so there's nothing to read
from a file in the first place. user-dirs.dirs remains a separate,
manually tracked dotfile (edited and tracked by hand, like any other
dotfile) for apps/xdg-user-dirs-update to consult -- dot setup folders
itself no longer reads it, requires its presence, or writes to it.
Acceptance criteria
_dot_setup_foldersno longer reads, parses, or requires~/.config/user-dirs.dirs; the legacy->short-name mapping is a fixed table in the function itself- Migration works identically whether
user-dirs.dirsis absent, empty, or declares stale/full-name values (the exact real-world case) user-dirs.dirsis left byte-for-byte untouched bydot setup folderswhen present, and no file is created when absentdot setup folders helpno longer describes reading target names fromuser-dirs.dirs~/.config/dot/tests/dot.fishno longer seeds auser-dirs.dirsfixture as a migration precondition, and covers the stale/missing cases above;fishtape ~/.config/dot/tests/dot.fishpasses
Implementation Notes
- Replaced the
xdg_vars/grep/string matchparsing ofuser-dirs.dirswith two parallel hardcoded arrays,legacy_namesandtarget_names, indexed together -- same shape the code already used forlegacy_namesalone, just extended to cover the target side too. - The early
if not test -f $user_dirs; return 1guard was deleted outright rather than kept as a soft check: there's nothing left for the function to read from that file, so requiring its existence would just be a vestigial, unjustifiable precondition. - Removed the
short_name_user_dirsfixture and its seeding step from every test scenario (it was previously duplicated into ~15 scenarios as a migration precondition); added two new scenarios instead: one reproducing the exact real-machine bug (stale full-nameuser-dirs.dirsvalues) and one confirming migration works with nouser-dirs.dirsfile at all. - Verified against this machine's real, still-stale
~/.config/user-dirs.dirsvia_dot_setup_folders --dry-run: previously reported every entry in Desktop/Documents/Downloads/Pictures/Videos as a collision against itself; now correctly reportswould move N entries from ~/Documents to ~/docetc. fishtape ~/.config/dot/tests/dot.fishpasses (183 tests).