mirror of
https://github.com/nix-community/home-manager
synced 2024-11-23 11:39:46 +01:00
files: quote cmp file arguments
Before this change, a warning would be printed to the console if you tried to manage a file in a path containing a space. For example, `vscodium`'s `userSettings` file on Darwin is at `~/Library/Application Support/VSCodium/User/settings.json`.
This commit is contained in:
parent
bc0acdad8c
commit
bb72555852
1 changed files with 2 additions and 2 deletions
|
@ -107,7 +107,7 @@ in
|
||||||
elif [[ -e "$targetPath" \
|
elif [[ -e "$targetPath" \
|
||||||
&& ! "$(readlink "$targetPath")" == $homeFilePattern ]] ; then
|
&& ! "$(readlink "$targetPath")" == $homeFilePattern ]] ; then
|
||||||
# The target file already exists and it isn't a symlink owned by Home Manager.
|
# The target file already exists and it isn't a symlink owned by Home Manager.
|
||||||
if cmp -s $sourcePath $targetPath; then
|
if cmp -s "$sourcePath" "$targetPath"; then
|
||||||
# First compare the files' content. If they're equal, we're fine.
|
# First compare the files' content. If they're equal, we're fine.
|
||||||
warnEcho "Existing file '$targetPath' is in the way of '$sourcePath', will be skipped since they are the same"
|
warnEcho "Existing file '$targetPath' is in the way of '$sourcePath', will be skipped since they are the same"
|
||||||
elif [[ ! -L "$targetPath" && -n "$HOME_MANAGER_BACKUP_EXT" ]] ; then
|
elif [[ ! -L "$targetPath" && -n "$HOME_MANAGER_BACKUP_EXT" ]] ; then
|
||||||
|
@ -180,7 +180,7 @@ in
|
||||||
$DRY_RUN_CMD mv $VERBOSE_ARG "$targetPath" "$backup" || errorEcho "Moving '$targetPath' failed!"
|
$DRY_RUN_CMD mv $VERBOSE_ARG "$targetPath" "$backup" || errorEcho "Moving '$targetPath' failed!"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -e "$targetPath" && ! -L "$targetPath" ]] && cmp -s $sourcePath $targetPath ; then
|
if [[ -e "$targetPath" && ! -L "$targetPath" ]] && cmp -s "$sourcePath" "$targetPath" ; then
|
||||||
# The target exists but is identical – don't do anything.
|
# The target exists but is identical – don't do anything.
|
||||||
$VERBOSE_ECHO "Skipping '$targetPath' as it is identical to '$sourcePath'"
|
$VERBOSE_ECHO "Skipping '$targetPath' as it is identical to '$sourcePath'"
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue