Do not use ext diff when detecting change in whats-cooking
[git/dscho.git] / Reintegrate
blobd9f14f2363ff837d9130d373a9a6250dc291dd3b
1 #!/bin/sh
3 accept_rerere=t generate=no
4 while case "$#,$1" in 0,*) break;; *,-*) ;; esac
5 do
6 case "$1" in
7 -n) accept_rerere= ;;
8 *) generate=yes
9 break ;;
10 esac
11 shift
12 done
14 case "$generate" in
15 no)
16 accept_rerere () {
17 if test -z "$accept_rerere"
18 then
19 return 1
21 if git diff |
22 grep -e "^.+" -e "^+." |
23 grep -e "^..<<<<<<<" -e "^..=======" -e "^..>>>>>>>" >/dev/null
24 then
25 return 1
26 else
27 EDITOR=: git commit -a --no-verify
28 return 0
32 while read branch eh
34 case "$eh" in
35 "")
36 echo >&2 "* $branch"
37 git merge "$branch" || accept_rerere || exit
38 if git show-ref -q --verify "refs/merge-fix/$branch"
39 then
40 git cherry-pick --no-commit "refs/merge-fix/$branch" &&
41 EDITOR=: git commit --amend -a
44 pick" "*)
45 echo >&2 "* $eh"
46 git cherry-pick "$branch" || exit ;;
47 *) echo >&2 "Eh? $branch $eh"; exit ;;
48 esac
49 done
50 exit
51 esac
53 merge_msg="Merge branch '\(.*\)'"
54 x40='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]'
55 x40="$x40$x40$x40$x40$x40$x40$x40$x40"
56 LF='
59 show_merge () {
60 branch=$(expr "$msg" : "$merge_msg") &&
61 tip=$(git rev-parse --verify "refs/heads/$branch" 2>/dev/null) &&
62 merged=$(git name-rev --refs="refs/heads/$branch" "$other" 2>/dev/null) &&
63 merged=$(expr "$merged" : "$x40 \(.*\)") &&
64 test "$merged" != undefined || {
65 other=$(git log -1 --pretty='format:%s' $other) &&
66 merged="$branch :rebased? $other"
70 show_pick () {
71 merged="$(git rev-parse --verify "$commit") pick $msg"
74 echo '#!/bin/sh'
75 echo "$0 <<\\EOF"
77 git log --pretty=oneline --first-parent "$1" |
79 series=
80 while read commit msg
82 if other=$(git rev-parse -q --verify "$commit^2")
83 then
84 show_merge
85 else
86 show_pick
89 if test -z "$series"
90 then
91 series="$merged"
92 else
93 series="$merged$LF$series"
95 done
96 echo "$series"
99 echo EOF