What's cooking (2012/07 #09)
[git.git] / check-topic-merges
blobb6d66b840ddaa5354e85ca926a5346e9d45527f3
1 #!/bin/sh
3 # Run this script _after_ making a proposed merge into a copy of
4 # the target branch (e.g. "master") to see if it contains unrelated
5 # merging back from the upstream.
7 F=`git diff-tree -r --name-only HEAD^ HEAD`
8 echo "The topic modifies these paths:"
9 echo "$F" | sed -e 's/^/ /'
11 _x40='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]'
12 _x40="$_x40$_x40$_x40$_x40$_x40$_x40$_x40$_x40"
13 git rev-list --parents master..HEAD^2 |
14 sed -ne "/^$_x40 $_x40 $_x40/p" |
15 while read merge first second
17 echo
18 # First is the previous cvs topic tip, second is what was merged into
19 # it. Does the merge have anything to do with adjust the topic to
20 # updated upstream?
21 git name-rev "$merge"
22 out=`git diff-tree --stat "$merge^" "$merge" -- $F`
23 case "$out" in
24 '')
25 echo "* Nothing to do with the topic" ;;
27 echo "$out" ;;
28 esac
29 done