Skip to content

Merge defaults across successive tasks - #399

Open
johnlettman wants to merge 1 commit into
anishathalye:masterfrom
johnlettman:johnlettman/merge-defaults
Open

Merge defaults across successive tasks#399
johnlettman wants to merge 1 commit into
anishathalye:masterfrom
johnlettman:johnlettman/merge-defaults

Conversation

@johnlettman

Copy link
Copy Markdown

Recursively merge Dotbot defaults instead of replacing the existing mapping, preserving unrelated plugin settings while allowing later values to override specific nested options.

The change makes successive defaults directives merge recursively instead of replacing the entire defaults mapping.

Example

Starting from the following example:

- defaults:
    shell:
      quiet: true
    link:
      create: true
      relink: true
    sync:
      stdout: true
      stderr: true
      options: ["--safe-links"]

- if:
    cond: '[ -v DOT_NO_AUR_PROMPT ]'
    met:
      - defaults:
          paru:
            interactive: false
    unmet:
      - defaults:
          paru:
            interactive: true

When the met branch runs, Dotbot now produces defaults equivalent to:

shell:
  quiet: true
link:
  create: true
  relink: true
sync:
  stdout: true
  stderr: true
  options: ["--safe-links"]
paru:
  interactive: false

Previously, adding the paru defaults replaced the entire mapping, silently discarding the existing shell, link, and sync settings. Recursive merging preserves those settings while allowing the conditional branch to add or override only paru.interactive.

Recursively merge Dotbot defaults instead of replacing the existing mapping,
preserving unrelated plugin settings while allowing later values to override
specific nested options.

Add regression tests covering nested merges, overrides, and input isolation.
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