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
|
@ -107,7 +107,7 @@ in
|
|||
elif [[ -e "$targetPath" \
|
||||
&& ! "$(readlink "$targetPath")" == $homeFilePattern ]] ; then
|
||||
# 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.
|
||||
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
|
||||
|
@ -180,7 +180,7 @@ in
|
|||
$DRY_RUN_CMD mv $VERBOSE_ARG "$targetPath" "$backup" || errorEcho "Moving '$targetPath' failed!"
|
||||
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.
|
||||
$VERBOSE_ECHO "Skipping '$targetPath' as it is identical to '$sourcePath'"
|
||||
else
|
||||
|
|
Loading…
Reference in a new issue