3 accept_rerere
="--rerere-autoupdate" generate
=no update
= diff= edit
= stop_at_cut
=
4 while case "$#,$1" in 0,*) break;; *,-*) ;; esac
10 -c?
*) stop_at_cut
=${1#-c} ;;
11 -d) update
=${2?"diff with what?"}
15 -u) update
=${2?"update what?"}
25 test -f Meta
/whats-cooking.txt ||
return 0
28 my ($branch) = $ARGV[0];
29 my ($in_section, $in_desc);
37 last if (/^[-*\[]/ && $in_section);
38 next unless $in_section;
43 next unless ($in_section && $in_desc);
47 if ($in_section && @msg) {
48 open(my $fh, "-|", qw(git cat-file commit HEAD));
49 my @original = (<$fh>);
54 $in_section = 1 if (/^$/);
58 if (/^$/ && $in_section == 1) {
65 open($fh, "|-", qw(git commit --amend -F -));
69 ' <Meta
/whats-cooking.txt
"$1"
75 if ! git write-tree
2>/dev
/null
>/dev
/null
80 EDITOR
=: git commit
--no-verify
81 echo "Accepted previous resolution"
89 case "$branch" in '###') cut_seen
=$
(( $cut_seen + 1 )) ;; esac
90 if test -n "$stop_at_cut" && test $stop_at_cut -le $cut_seen
107 save
=$
(git rev-parse
--verify HEAD
)
108 tip
=$
(git rev-parse
--verify "$branch^0")
109 mb
=$
(git merge-base
"$tip" "$save")
110 test "$mb" = "$tip" && continue
112 EDITOR
=: git merge
$accept_rerere --edit "$branch" ||
116 annotate_merge
"$branch" ||
exit
118 git commit
--amend ||
exit
120 this
=$
(git rev-parse
--verify HEAD
)
121 if test "$this" = "$save"
124 elif git show-ref
-q --verify "refs/merge-fix/$branch"
126 echo >&2 "Fixing up the merge"
127 git cherry-pick
--no-commit "refs/merge-fix/$branch" &&
128 EDITOR
=: git commit
--amend -a ||
exit
133 git cherry-pick
"$branch" ||
exit ;;
134 *) echo >&2 "Eh? $branch $eh"; exit ;;
140 if test -n "$update" && test $# = 0
142 set x $
(sed -n -e '2s/^# //p' <"$update") &&
146 # Generation (or updating)
148 x40
='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]'
149 x40
="$x40$x40$x40$x40$x40$x40$x40$x40"
155 "Merge branch '"*"'"*)
156 branch
=$
(expr "$msg" : "Merge branch '\(.*\)'")
159 "Merge remote branch '"*"'"*)
160 branch
=$
(expr "$msg" : "Merge remote branch '\(.*\)'")
164 echo 2>&1 "Huh?: $msg"
168 tip
=$
(git rev-parse
--verify "refs/$merge_hier$branch" 2>/dev
/null
) &&
169 merged
=$
(git name-rev
--refs="refs/$merge_hier$branch" "$other" 2>/dev
/null
) &&
170 merged
=$
(expr "$merged" : "$x40 \(.*\)") &&
171 test "$merged" != undefined ||
{
172 other
=$
(git log
-1 --pretty='format:%s' $other) &&
173 merged
="$branch :rebased? $other"
178 merged
="$(git rev-parse --verify "$commit") pick $msg"
186 echo 'case "$#,$1" in'
188 echo " exec $PROGRAM" '"$1" "$0"'
190 echo "$PROGRAM" '"$@" <<\EOF'
191 git log
--no-decorate --pretty=oneline
--first-parent "$1" |
194 while read commit msg
196 if other
=$
(git rev-parse
-q --verify "$commit^2")
207 series
="$merged$LF$series"
220 generate
"$0" "$@" |
diff -u "$update" -
223 echo >&2 "No changes."
225 echo >&2 -n "Update [y/N]? "
230 sed -e 's/ :rebased?.*//' >"$update" ;;
232 echo >&2 "No update then." ;;
236 generate
"$0" "$@" |
diff -u "$update" -