patchutils
patchutils copied to clipboard
filterdiff should have an --in-place option
i often have to write loops like for x in *.patch; do filterdiff ... $x > f; mv f $x; done. would be super handy if i could just run filterdiff --in-place *.patch.
i picked --in-place because that's what sed uses. but -i is already taken by --include, so maybe it'd be -w --write with --in-place as an alias ?
I have written this trivial script moddiff for the same purpose:
#!/bin/bash
set -eu
TEMPFILE=$(mktemp /tmp/moddiff.XXXXXX.patch)
trap 'rm -f $TEMPFILE' EXIT
ARGS=("$@")
filterdiff "${ARGS[@]}" >$TEMPFILE
mv $TEMPFILE "${ARGS[-1]}"
so I can then run something like (in fish):
for pf in *.patch
moddiff -p1 -i 'lexers/*' -x '*.properties' $pf
end
I wouldn’t have a problem if it was included in this package, and just to be sure, I release this triviality to the public domain.