Skip to content

Conversation

@bep
Copy link
Member

@bep bep commented Oct 21, 2025

Now, with YAML anchor and alias support, these can point to shared data,
which must not be modified in place.

Fixes #14072

@bep bep changed the title config: Clone language mep entries before modifying them config: Clone language map entries before modifying them Oct 21, 2025
@bep bep requested a review from Copilot October 21, 2025 10:29
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes issue #14072 by preventing in-place modification of shared configuration data that can occur with YAML anchors and aliases. The solution involves deep-cloning language map entries before modification.

  • Introduces CloneParamsDeep function to recursively clone nested Params maps
  • Adds cycle detection to SetParams via depth tracking
  • Clones language configuration entries before merging to avoid modifying shared references

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
common/maps/params.go Adds CloneParamsDeep function and refactors SetParams with cycle detection; removes shallow clone during merge
config/allconfig/allconfig.go Clones language config entries before modification and removes now-redundant shallow clone
hugolib/config_test.go Re-enables previously skipped test and increases test iteration count
common/hdebug/debug.go Adds new debug utilities (unrelated to the main fix)

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Now, with YAML anchor and alias support, these can point to shared data,
which must not be modified in place.

Fixes gohugoio#14072
@bep bep merged commit a130770 into gohugoio:master Oct 21, 2025
6 checks passed
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.

Fix shaky test / params YAML alias merge issue

1 participant