fix(manifest): preserve substituted file newlines
This commit is contained in:
1 parent
db499bff81
commit
62513b6858
3 files changed
+10
-3
No files matched your search
@@ -68,10 +68,12 @@ sync_managed_destination() {
|
||||
relative=${source_file#"$source/"}
|
||||
if [ "${destination##*/}" = .codex ] && [[ "$relative" = skills/* ]]; then continue; fi
|
||||
target="$destination/$relative"
|
||||
content=$(<"$source_file")
|
||||
content=$(cat -- "$source_file" && printf '\034') || return
|
||||
content=${content%$'\034'}
|
||||
needs_sub=false
|
||||
if [ "$flashbang_enabled" = false ] && [[ "$relative" = settings.json || "$relative" = config.toml ]]; then
|
||||
content=$(python3 "$(dirname -- "${BASH_SOURCE[0]}")/install-options.py" filter --path "$source_file" --flashbang false) || return
|
||||
content=$(python3 "$(dirname -- "${BASH_SOURCE[0]}")/install-options.py" filter --path "$source_file" --flashbang false && printf '\034') || return
|
||||
content=${content%$'\034'}
|
||||
needs_sub=true
|
||||
fi
|
||||
if [[ "$needs_sub" = true || "$content" == *'__AI_CONFIG_ROOT__'* || "$content" == *'__HOOK_COMMAND__'* || "$content" == *'__POWERSHELL_HOOK_COMMAND__'* || "$content" == *'__POWERSHELL_COMMAND__'* || "$content" == *'__CLAUDE_CODE_MAX_TOOL_USE_CONCURRENCY__'* ]]; then
|
||||
|
||||
@@ -30,6 +30,11 @@ out2=$(sync_managed_destination "$source_dir" "$destination" run2 "$destination"
|
||||
[ -z "$(printf '%s\n' "$out2" | grep -v '^UNCHANGED' | grep -v '^SOURCE ')" ] || { printf 'Second identical install was not a no-op:\n%s\n' "$out2" >&2; exit 1; }
|
||||
[ ! -d "$destination/backups/run2" ] || { printf 'Idempotent install must not create a backup.\n' >&2; exit 1; }
|
||||
|
||||
printf 'root=__AI_CONFIG_ROOT__\n\n' > "$source_dir/newlines.txt"
|
||||
printf 'root=%s\n\n' "$destination" > "$work/expected-newlines.txt"
|
||||
sync_managed_destination "$source_dir" "$destination" newlines "$destination" bash bash false > /dev/null
|
||||
cmp -s "$work/expected-newlines.txt" "$destination/newlines.txt" || { printf 'Substitution changed terminal newlines.\n' >&2; exit 1; }
|
||||
|
||||
printf 'mine' > "$destination/foreign.md"
|
||||
|
||||
rm -f "$source_dir/b.md" "$source_dir/c.md"
|
||||
|
||||
Reference in new issue
Block a user