Closed YHYJ closed 1 year ago
chezmoi: template: commit_message:5:74: executing "commit_message" at <fail .>: error calling fail: unsupported XY: ".M"
This occurs because the git repo has got into a state that chezmoi cannot generate a commit message for.
What's the output of the following commands?
$ chezmoi cd
$ git status
$ git status --ignored --porcelain=v2
sourceDir = "~/Documents/System/Profile"
, and 'Profile' is a git submodule of 'System', chezmoi cd
goes to 'System', not 'Profile'Thank you for the follow-up.
I am confused by the output of git status --ignored --porcelain=v2
. In all lines of the output the file permissions (columns 4, 5, and 6) are unchanged at 100644
, and the file content hashes (columns 7 and 8) are also unchanged, and yet the XY field (column 2) shows .M
, indicating that something has been modified. If you're interested in the details, see the man page for git status
.
Do you know what could have been modified? Could there be some other attributes not tracked by git or some kind of ACL changes?
What's the output of
$ chezmoi cd
$ git diff
?
As a side thread, ~/.config/chezmoi/chezmoi.toml
should not be managed by chezmoi. You should use a config file template instead.
- I set
sourceDir = "~/Documents/System/Profile"
, and 'Profile' is a git submodule of 'System',chezmoi cd
goes to 'System', not 'Profile'
Ah, on further reflection, I think this is the cause. Thank you for identifying this. I'm reasonably sure that chezmoi's autoCommit
and autoPush
do not currently support changes in git submodules. Assuming this is true, I'll update this issue's descriptions and tags.
To further confirm this, the output of chezmoi doctor
shows that chezmoi is very confused by the use of git submodules:
RESULT CHECK MESSAGE
...
warning source-dir ~/Documents/System/Profile is a git working tree (dirty)
warning suspicious-entries ~/Documents/System/Profile~/private_dot_config/chezmoi/chezmoi.toml
warning working-tree ~/Documents/System is a git working tree (dirty)
Thanks for your answer.
I think .M
is 'modified' meaning i modified the file? git diff
shows those changes.
I got config file template,thanks.
To further confirm this, the output of
chezmoi doctor
shows that chezmoi is very confused by the use of git submodules:RESULT CHECK MESSAGE ... warning source-dir ~/Documents/System/Profile is a git working tree (dirty) warning suspicious-entries ~/Documents/System/Profile~/private_dot_config/chezmoi/chezmoi.toml warning working-tree ~/Documents/System is a git working tree (dirty)
Yes, there is no such confusion without using git submodule
I'm not very familiar with git submodules, and every time I've tried to used git submodules I've encountered lots of problems, so I'll accept a PR that fixes this, but do not plan to work on this myself.
I’ve done a lot with submodules as a consumer, but I’m not sure how a test for this would be set up. Ideally, @YHYJ could set up a repo-set that models this—or perhaps a docker image so that we can run this in a wholly isolated way and then we might be able to simulate it.
I’ve done a lot with submodules as a consumer, but I’m not sure how a test for this would be set up. Ideally, @YHYJ could set up a repo-set that models this—or perhaps a docker image so that we can run this in a wholly isolated way and then we might be able to simulate it.
I'm not very familiar with git submodules, what this means and how to do it.
What I’d be looking for in order to be able to debug this would be a repo setup that exhibits the same as your configuration does, but with as few files as possible so we can try to understand this.
Somehow, your source directory is a git submodule, right? Which means it’s a submodule of something else. If you can make a pair of clean repos (a simulated source directory, and a repo which has that as a submodule) that can be used with Chezmoi to show this, then I think we can investigate. As of right now, I have no clue how to investigate what you’ve reported.
Now I have a repo chezmoi-test which has a submodule dotfile-test, please read chezmoi-test/README.md first.
dotfile-test only stores the neofetch configuration file.
Thanks. I may be able to look at this on the weekend; if not, it will probably be December before I can do so.
Thanks for your work!
I’m hitting some walls trying to get everything set up to test this; I’ve forked your original repo and added some testing details to it: https://github.com/halostatue/chezmoi-submodule-test
At the moment, I’m hitting issues with SSH agent forwarding and docker, so it’s not directly related, and I’m trying to work in a wholly isolated environment.
Run with ./run
.
As this is a specific case that hasn't been updated in over six months, I'll close this. Please re-open if needed.
Describe the bug
After run
chezmoi re-add
, autoCommit reports an error:To reproduce
autoCommit = true
chezmoi --destination / re-add
(I set the destination directory/
)Expected behavior
autoCommit successfully executed
Output of command with the
--verbose
flagOutput of
chezmoi doctor
Additional context
Add any other context about the problem here.