]> git.ozlabs.org Git - next-scripts/commitdiff
merge_msg: Change it to take the conflicting commits and files
authorMichael Ellerman <mpe@ellerman.id.au>
Fri, 19 Jun 2015 05:50:41 +0000 (15:50 +1000)
committerMichael Ellerman <mpe@ellerman.id.au>
Fri, 19 Jun 2015 05:55:29 +0000 (15:55 +1000)
merge_msg

index dbee7ccdc4ed2ad5dbccc51d3e94797f1fbc15fe..8c314319c66c1f7bd119e0c327a7edafbf4071d7 100755 (executable)
--- a/merge_msg
+++ b/merge_msg
@@ -6,10 +6,18 @@ branch=""
         shift 2
 }
 
-file="$*"
+commit1=$1
+shift
+
+commit2=$1
+shift
 
-gitk --merge -- $file &
-[ "$file" ] && gvim $file 2>/dev/null
+if [[ -z $commit1 || -z $commit2 ]]; then
+       echo "Usage: $0 [-t branch] commit1 commit2 [files...]" >&2
+       exit 1
+fi
+
+file="$*"
 
 conf="a conflict"
 [ "$#" -gt 1 ] && {
@@ -20,11 +28,47 @@ conf="a conflict"
 
 subject="manual merge of the BRANCH tree with the FIXME tree"
 
+c1_title=$(git log -1 --pretty="%h \"%s\"" $commit1)
+c2_title=$(git log -1 --pretty="%h \"%s\"" $commit2)
+c1_addrs=$(git log -1 --pretty="%an <%ae>, %cn <%ce>" $commit1)
+c2_addrs=$(git log -1 --pretty="%an <%ae>, %cn <%ce>" $commit2)
+c1_sobs=$(git log -1 --pretty="%b" $commit1 | awk '$1 ~ /-by:/ {$1=""; print $0","}')
+c2_sobs=$(git log -1 --pretty="%b" $commit2 | awk '$1 ~ /-by:/ {$1=""; print $0","}')
+
+diff=$(git diff $file)
+
 $(dirname $0)/message_helper $branch "$subject" <<EOF
-Today's linux-next merge of the BRANCH tree got $conf in $file between commit  ("") from the FIXME tree and commit  ("") from the BRANCH tree.
+Today's linux-next merge of the BRANCH tree got $conf in:
+
+  $file
+
+between commit:
+
+  $c1_title
+
+  Author/committer:
+  $c1_addrs
+  SOBS:
+  $c1_sobs
+
+from the FIXME tree and commit:
+
+  $c2_title
+
+  Author/committer:
+  $c2_addrs
+  SOBS:
+  $c2_sobs
+
+from the BRANCH tree.
 
 I fixed it up (see below) and can carry the fix as necessary (no action
 is required).
+
+cheers
+
+
+$diff
 EOF
 
 exit 0