3 accept_rerere
=t generate
=no update
= diff=
4 while case "$#,$1" in 0,*) break;; *,-*) ;; esac
8 -d) update
=${2?"diff with what?"}
12 -u) update
=${2?"update what?"}
24 if test -z "$accept_rerere"
29 grep -e "^.+" -e "^+." |
30 grep -e "^..<<<<<<<" -e "^..
=======" -e "^..
>>>>>>>" >/dev/null
34 EDITOR=: git commit -a --no-verify
35 echo "Accepted previous resolution
"
42 case "$branch" in '#'*) continue ;; esac
45 save=$(git rev-parse --verify HEAD)
48 git merge "$branch" || accept_rerere || exit
50 this=$(git rev-parse --verify HEAD)
51 if test "$this" = "$save"
54 elif git show-ref -q --verify "refs
/merge-fix
/$branch"
56 echo >&2 "Fixing up the merge
"
57 git cherry-pick --no-commit "refs
/merge-fix
/$branch" &&
58 EDITOR=: git commit --amend -a || exit
63 git cherry-pick "$branch" || exit ;;
64 *) echo >&2 "Eh?
$branch $eh"; exit ;;
70 if test -n "$update" && test $# = 0
72 set x $(sed -n -e '2s/^# //p' <"$update") &&
76 # Generation (or updating)
78 x40='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]'
79 x40="$x40$x40$x40$x40$x40$x40$x40$x40"
85 "Merge branch
'"*"'"*)
86 branch=$(expr "$msg" : "Merge branch
'\(.*\)'")
89 "Merge remote branch
'"*"'"*)
90 branch=$(expr "$msg" : "Merge remote branch
'\(.*\)'")
94 echo 2>&1 "Huh?
: $msg"
98 tip=$(git rev-parse --verify "refs
/$merge_hier$branch" 2>/dev/null) &&
99 merged=$(git name-rev --refs="refs
/$merge_hier$branch" "$other" 2>/dev/null) &&
100 merged=$(expr "$merged" : "$x40 \
(.
*\
)") &&
101 test "$merged" != undefined || {
102 other=$(git log -1 --pretty='format:%s' $other) &&
103 merged="$branch :rebased?
$other"
108 merged="$
(git rev-parse
--verify "$commit") pick
$msg"
116 echo 'case "$#,$1" in'
118 echo " exec $PROGRAM" '"$1" "$0"'
120 echo "$PROGRAM" '"$@" <<\EOF'
121 git log
--pretty=oneline
--first-parent "$1" |
124 while read commit msg
126 if other
=$
(git rev-parse
-q --verify "$commit^2")
137 series
="$merged$LF$series"
150 generate
"$0" "$@" |
diff -u "$update" -
153 echo >&2 "No changes."
155 echo >&2 -n "Update [Y/n]? "
160 sed -e 's/ :rebased?.*//' >"$update" ;;
162 echo >&2 "No update then." ;;
166 generate
"$0" "$@" |
diff -u "$update" -