fix: ensure that diffing is done in the right direction

This commit is contained in:
Marc 2024-02-29 00:51:42 -05:00
parent bc0f75e65c
commit 7a71ab38f4
Signed by: marc
GPG key ID: 048E042F22B5DC79

View file

@ -59,7 +59,7 @@ copy_file() {
return 0
fi
difference=$(diff "$source_path" "$dest_path")
difference=$(diff "$dest_path" "$source_path")
if [ -z "$difference" ]; then
echo "$dest_path already exists, but is the same as $source_path - skipping."
@ -67,7 +67,7 @@ copy_file() {
fi
echo "Differences detected between $source_path and $dest_path:"
diff --color "$source_path" "$dest_path"
diff --color "$dest_path" "$source_path"
read -p "$dest_path already exists. What should be done? [O:overwrite,S:skip,B:save backup and copy] " -r action
if [[ $action == "O" ]]; then