bin: improve file diffing

This commit is contained in:
xeruf 2023-01-06 12:42:16 +01:00
parent 1f7cd8cfa7
commit 4c7d80edcb
2 changed files with 8 additions and 1 deletions

View File

@ -16,7 +16,7 @@ if ! test "$command"; then
(*sqlite*) sqldiff --summary "${files[@]}" | grep -v '0 changes, 0 inserts, 0 deletes';; # TODO syntax highlighting for INSERT/UPDATE/DELETE
(text/*)
# Use wiked-diff only for text <10MB
if test 10000000 -gt "$(stat --format=%s *.geojson | paste -s -d'+' | bc)"
if test 10000000 -gt "$(stat --format=%s "${files[@]}" | paste -s -d'+' | bc)"
then wiked-diff "${files[@]}"
else diff --color=always --unified=1 --report-identical-files "${files[@]}"
fi;;

7
.local/bin/scripts/treediff Executable file
View File

@ -0,0 +1,7 @@
#!/bin/sh -e
# Diff the existing filenames between the given directories
command() {
find "$1" -printf '%P\n' | sort
}
wiked-diff --colored-blocks false <(command "$1") <(command "$2") |
less --RAW-CONTROL-CHARS --quit-on-intr --quit-if-one-screen