#!/bin/bash REJ_FILES=$(find . -name '*.rej') function cleanup_prompt { echo echo "Done: $f" res=xxx while true ; do read -n 1 -p "Cleanup [y/n/q]" res case $res in q) exit 1 ;; y) return 0 ;; # true n) return 1 ;; # false esac done exit 1 } for rej in $REJ_FILES ; do orig=${rej/%.rej/.orig} file=${rej/%.rej/} if [ -f "$orig" ] && [ -f "$rej" ] && [ -f "$file" ] ; then echo "$orig $rej $file" #vimdiff <(cg-admin-cat HEAD $file) vim -O "$file" "$rej" # need to ask #echo rm $rej if cleanup_prompt $file ; then mv "$rej" ~/tmp/"$(echo $rej | sed s,^\.\/,, | tr / _)" mv "$orig" ~/tmp/"$(echo $orig | sed s,^\.\/,, | tr / _)" fi else echo "Could not find one of the components of $file{,.orig,.rej}" >&2 fi done #echo #echo 'reminder...' #next=$(printf '%04d' $(cat .dotest/next)) #echo "diffstat -p1 -l .dotest/$next | xargs git-update-index --remove --add" #echo 'git-am -3 --resolved'