forked from twpayne/chezmoi
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Fix use of .chezmoiroot in multiple commands
- Loading branch information
Showing
4 changed files
with
45 additions
and
10 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,28 @@ | ||
mksourcedir | ||
|
||
# test that chezmoi source-path returns the source directory | ||
chezmoi source-path | ||
cmpenv stdout golden/source-path | ||
stdout ^${CHEZMOISOURCEDIR@R}$ | ||
|
||
# test that chezmoi source-path target returns the path to a target's source file | ||
chezmoi source-path $HOME${/}.file | ||
cmpenv stdout golden/source-path-file | ||
stdout ^${CHEZMOISOURCEDIR@R}/dot_file$ | ||
|
||
# test that chezmoi source-path returns an error if the target is not in the source state | ||
! chezmoi source-path $HOME${/}.newfile | ||
stderr 'not in source state' | ||
|
||
# test that chezmoi source-path returns an error if the target is not in the destination directory | ||
! chezmoi source-path $WORK${/}etc${/}passwd | ||
stderr 'not in' | ||
|
||
-- golden/source-path -- | ||
$CHEZMOISOURCEDIR | ||
-- golden/source-path-file -- | ||
$CHEZMOISOURCEDIR/dot_file | ||
chhome home2/user | ||
|
||
# test that chezmoi source-path target returns the path the target's source file when .chezmoiroot is used | ||
chezmoi source-path $HOME${/}.file | ||
stdout /home/dot_file$ | ||
|
||
-- home/user/.local/share/chezmoi/dot_file -- | ||
# contents of .file | ||
-- home2/user/.local/share/chezmoi/.chezmoiroot -- | ||
home | ||
-- home2/user/.local/share/chezmoi/home/dot_file -- | ||
# contents of .file |