summary refs log tree commit diff
path: root/xdiff
blob: 406e24f7d64e5fa21600978190ec855950d297bd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/bin/sh
# xdiff [-u] [DIR] - merge XBPS .new-* files

mergeutil() {
	vimdiff "$1" "$2" && rm -vi "$1"
}

if [ "$1" = -u ]; then
	shift
	DIFF="diff -u"
else
	DIFF=mergeutil
fi

DIR=${1:-/etc}

for newfile in $(find "$DIR" -name '*.new-*_*'); do
	$DIFF "$newfile" "${newfile%.new-*_*}"
done