Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add --init option to update command #1472

Merged
merged 1 commit into from
Sep 29, 2021
Merged

feat: Add --init option to update command #1472

merged 1 commit into from
Sep 29, 2021

Conversation

twpayne
Copy link
Owner

@twpayne twpayne commented Sep 29, 2021

Fixes #1427.

@twpayne twpayne merged commit 55a4b93 into master Sep 29, 2021
@twpayne twpayne deleted the update-init branch September 29, 2021 22:03
@twpayne
Copy link
Owner Author

twpayne commented Sep 29, 2021

@felipecrs A quick heads up on this. This PR fixes the immediate issue, but there's a more subtle underlying problem that you as an advanced user of chezmoi might encounter.

Very roughly, chezmoi's reading config code looks like this:

  1. Set defaults.
  2. Read config from user.
  3. Compute extra config variables derived from user config (e.g. guess workingTree from sourceDir if workingTree is not explicitly set, refs feat: Add working tree config option #1459).

This --init flag to chezmoi update only performs step 2 above and does not perform step 3. This means that if you're changing directories or removing template variables (and maybe other things) then the config used by chezmoi update --init might differ from the config used by the next invocation of chezmoi update.

In practice, as long as the config changes are small this should not be a problem, but I know that you occasionally make big config changes (e.g. #1430), so I wanted to warn you.

@felipecrs
Copy link
Contributor

Interesting, I will have this in mind. Thanks a lot for this new feature!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

chezmoi update --init
2 participants