From 48275e0edce0dfa703fb4a8bf3abbbac70f2cb2e Mon Sep 17 00:00:00 2001 From: Stephen Rothwell Date: Fri, 2 Oct 2020 13:24:27 +1000 Subject: [PATCH] merge_msg: prompt for the HEAD side trees involved --- merge_msg | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/merge_msg b/merge_msg index 011b699..0af3424 100755 --- a/merge_msg +++ b/merge_msg @@ -23,6 +23,25 @@ for c in "${head_commits[@]}"; do hc+=( "$(git log -1 --format='%h ("%s")' "$c")" ) readarray -t -O "${#cc[@]}" cc < <(git log -1 --format="$cformat" "$c" | sort -u) done +hcs='' +if [ "${#hc[@]}" -gt 1 ]; then + hcs='s' +fi + +read -r -a head_branches -p 'HEAD branch(es): ' + +hb=( "${head_branches[@]/%/,}" ) +hb[-1]=${hb[-1]%,} +if [ "${#hb[@]}" -gt 2 ]; then + hb[-2]=${hb[-2]/%,/ and} +fi +hbs='' +if [ "${#hb[@]}" -gt 1 ]; then + hbs='s' +fi + +printf -v subject 'manual merge of the BRANCH tree with the %s tree%s' \ + "${hb[*]}" "$hbs" printf -v files ' %s\n' "$@" conf='a conflict' @@ -30,8 +49,6 @@ if [ "$#" -gt 1 ]; then conf='conflicts' fi -subject='manual merge of the BRANCH tree with the FIXME tree' - "$tools_dir/message_helper" "${branch[@]}" "$subject" "${cc[@]}" <