Closed rivaldi8 closed 1 year ago
/tmp/chezmoi-merge3965727730/.bashrc
is a temporary file created by chezmoi to show you what the target state of the file looks like.
If you want to make changes to ~/.bashrc
or ~/.local/share/chezmoi/dot_bashrc
then you have to edit and save these files in your merge tool.
Ok, that really confused me. I'm used to merge tools like ones from VS Code or IntelliJ where you have two panes with the two file versions and a third with the result of the merge. So that's why I expected the third pane content to end up in ~/.bashrc
.
In fact, my confusion really comes from the "target state". After taking another look at the documentation I'm still not sure of its meaning.
Anyway, knowing that what I want is to modify the other two panes and ignore the 'target' is enough for my use case. Thanks for the clarification and sorry for the noise.
You can configure the order of the files in the merge tool using merge.args
.
For the target state, it's perhaps easiest to think of chezmoi is a program that generates your dotfiles for the current machine. Consider the case where you're generating ~/.bashrc
from a template. The source state (file) is ~/.local/share/chezmoi/dot_bashrc.tmpl
. The target state is the result of executing the template, and is what you want the contents of ~/.bashrc
to be. The destination state is the current contents of ~/.bashrc
.
These three states - source, target, and destination - can drift out of sync if you change your dotfiles without making equivalent changes to the source state. If this happens, the merge tool can help you update your source state with the changes to the destination state.
Describe the bug
The results of
chezmoi merge some-file
are lost. Neither the file in the home directory nor the one in the working copy are modified.To reproduce
Start with
.bashrc
managed by chezmoi, having the home directory and the working copy with the same content (chezmoi diff
prints no differences):~/.bashrc
.chezmoi diff
shows the differences.chezmoi merge
opensvimdiff
with~/.bashrc
,~/.local/share/chezmoi/dot_bashrc
and/tmp/chezmoi-merge3965727730/.bashrc
.# new line
at the end of/tmp/chezmoi-merge3965727730/.bashrc
, save the changes and quitvimdiff
.~/.bashrc
nor~/.local/share/chezmoi/dot_bashrc
have# new line
line.Expected behavior
~/.bashrc
should have# new line
line at the end.Output of command with the
--verbose
flagOutput of
chezmoi doctor
Additional context
Nothing relevant that I can think of.