#!/bin/bash
-subject="duplicate patches in the BRANCH tree"
-
tools_dir=$(dirname "$0")
-"$tools_dir"/message_helper "$@" "$subject" <<EOF
-The following commits are also in Linus Torvalds' tree as different commits
-(but the same patches):
-EOF
+subject='duplicate patch in the BRANCH tree'
+obranch="Linus Torvalds'"
+
+if [ "X$1" = "X-o" ]; then
+ shift
+ obranch="the $1"
+ shift
+fi
+
+body="The following commit is also in $obranch tree as a different commit (but the same patch):"
+
+if [ "X$1" = "X-p" ]; then
+ shift
+ subject="duplicate patches in the BRANCH tree"
+ body="The following commits are also in $obranch tree as different commits (but the same patches):"
+fi
+
+printf '%s\n' "$body" | fmt | "$tools_dir"/message_helper "$@" "$subject"
exit 0