Repository navigation
fix(install): dereference symlinked templates in preserved-file diffs - #1354
Merged
Merged
Conversation
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.
Summary
On
--forceupgrades the installer prints a diff between each preserved consumer file and the incoming template so template evolution can be folded in deliberately. In the shipped image the devkit assets are/nix/storesymlinks, sogit diff --no-indexcompared the link itself against the consumer's regular file and rendered a useless typechange ("symlink deleted / file added", with the store path as its only content line). Observed live on the vig-os/scitadel 0.3.3 → 1.6.0 migration.print_preserved_template_diffnow dereferences the template side before comparing: the resolved content is materialized under the file's own name in a temp dir, so the diff header keeps identifying the file rather than an opaque store path. A template symlink whose target does not resolve is still treated as a missing template ([[ -f ]]follows the link), so the function returns 1 with no output, as before. Constraints from #916 (git diff --no-index, nodiff(1)/cmp(1)in the image) and #1197 (GIT_DIR=/dev/null) are preserved.Test plan
preserved diff dereferences a symlinked template file (#1349): image-shaped template tree with the preserved file as a symlink to out-of-tree content; asserts the printed diff shows the template content and refutes the typechange rendering (RED before the fix, reproducing the exact live failure shape).tests/bats/init-workspace.bats: 280/280 green, including the fix(workspace): scaffold upgrade replaces .pre-commit-config.yaml, silently clobbering repo-specific hook config #878/fix(workspace): scaffold upgrade clobbers a customized .typos.toml (dual-config corruption) #913/fix(workspace): init-workspace upgrade hardening — git-diff preview, workflow scan scope, GITHUB_REPOSITORY ordering, pin stamp #916/print_preserved_template_diff emits 'not a git repository' noise when scaffolding a worktree via bare podman #1197 preserved-diff relatives.prek run --all-filesgreen.Refs: #1349