#!/bin/sh set -e fail () { echo >&2 "$0: $*"; exit 127; } case "$1" in --v1) how=same ;; # merge into tip from another tip of this patch # or into base from another base of this patch --v1-base) how=base ;; # merge into tip from a base of this patch --v1-dep) how=dep ;; # merge into base from a dep's tip *) fail "bad usage" ;; esac whichfile=$1 ancestor=$2 ours=$3 theirs=$4 markersize=$5 set -- "$ours" "$ancestor" "$theirs" case $on.$whichfile in dep.msg|dep.deps|dep.props) touch "$ours" ;; base.msg) echo '# not applicable' >"$ours" base.deps) echo >"$ours" touch >"$ours" ;; base.props) exec topbloke-merge-lists -M$markersize -P -UDeleted "$@" ;; same.msg) exec git-merge-file --marker-size=$markersize "$@" ;; same.deps|*.included) exec topbloke-merge-lists -M$markersize "$@" ;; same.props|*.pprops) exec topbloke-merge-lists -M$markersize -P "$@" ;; *) fail "huh $on $whichfile ?" ;; esac