Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add .chezmoiroot to allow source state to be subdir of source dir
Co-authored-by: Felipe Santos <felipecassiors@gmail.com>
- Loading branch information
Showing
5 changed files
with
91 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# test that chezmoi apply uses .chezmoiroot | ||
chezmoi apply | ||
cmp $HOME/.file golden/.file | ||
|
||
# test that chezmoi add uses .chezmoiroot | ||
symlink $HOME/.symlink -> .file | ||
chezmoi add $HOME${/}.symlink | ||
cmp $CHEZMOISOURCEDIR/home/symlink_dot_symlink golden/symlink_dot_symlink | ||
|
||
[!exec:git] skip 'git not found in $PATH' | ||
[windows] skip 'go-git does not support file:// URLs on windows' | ||
|
||
chhome home2/user | ||
mkgitconfig | ||
|
||
# create a git repo in home2/user/repo | ||
exec git -C $HOME/repo init | ||
exec git -C $HOME/repo add . | ||
exec git -C $HOME/repo commit -m 'Initial commit' | ||
|
||
# test that chezmoi init uses .chezmoiroot | ||
chezmoi init --apply file://$HOME/repo | ||
cmp $HOME/.file golden/.file | ||
|
||
-- golden/.file -- | ||
# contents of .file | ||
-- golden/symlink_dot_symlink -- | ||
.file | ||
-- home/user/.local/share/chezmoi/.chezmoiroot -- | ||
home | ||
-- home/user/.local/share/chezmoi/home/dot_file -- | ||
# contents of .file | ||
-- home2/user/repo/.chezmoiroot -- | ||
home | ||
-- home2/user/repo/home/dot_file -- | ||
# contents of .file |