git am $git_am_opt --rebasing --resolvemsg="$resolvemsg" &&
move_to_original_branch
ret=$?
-test 0 != $ret -a -d "$state_dir" &&
- echo $head_name > "$state_dir/head-name" &&
- echo $onto > "$state_dir/onto" &&
- echo $orig_head > "$state_dir/orig-head" &&
- echo "$GIT_QUIET" > "$state_dir/quiet"
+test 0 != $ret -a -d "$state_dir" && write_basic_state
exit $ret
mkdir "$state_dir" || die "Could not create temporary $state_dir"
: > "$state_dir"/interactive || die "Could not mark as interactive"
-echo "$head_name" > "$state_dir"/head-name
-
-echo $orig_head > "$state_dir"/head
+write_basic_state
case "$rebase_root" in
'')
rm -f "$state_dir"/rebase-root ;;
*)
: >"$state_dir"/rebase-root ;;
esac
-echo $onto > "$state_dir"/onto
test -z "$strategy" || echo "$strategy" > "$state_dir"/strategy
test t = "$verbose" && : > "$state_dir"/verbose
if test t = "$preserve_merges"
mkdir -p "$state_dir"
echo "$onto_name" > "$state_dir/onto_name"
-echo "$head_name" > "$state_dir/head-name"
-echo "$onto" > "$state_dir/onto"
-echo "$orig_head" > "$state_dir/orig-head"
-echo "$GIT_QUIET" > "$state_dir/quiet"
+write_basic_state
msgnum=0
for cmt in `git rev-list --reverse --no-merges "$revisions"`
read_basic_state () {
head_name=$(cat "$state_dir"/head-name) &&
onto=$(cat "$state_dir"/onto) &&
- if test "$type" = interactive
+ # We always write to orig-head, but interactive rebase used to write to
+ # head. Fall back to reading from head to cover for the case that the
+ # user upgraded git with an ongoing interactive rebase.
+ if test -f "$state_dir"/orig-head
then
- orig_head=$(cat "$state_dir"/head)
- else
orig_head=$(cat "$state_dir"/orig-head)
+ else
+ orig_head=$(cat "$state_dir"/head)
fi &&
GIT_QUIET=$(cat "$state_dir"/quiet)
}
+write_basic_state () {
+ echo "$head_name" > "$state_dir"/head-name &&
+ echo "$onto" > "$state_dir"/onto &&
+ echo "$orig_head" > "$state_dir"/orig-head &&
+ echo "$GIT_QUIET" > "$state_dir"/quiet
+}
+
output () {
case "$verbose" in
'')