output git rev-parse --verify $sha1 || die "Invalid commit name: $sha1"
test -d "$rewritten" &&
pick_one_preserving_merges "$@" && return
- if test -n "$rebase_root"
- then
- output git cherry-pick "$@"
- return
- fi
output git cherry-pick $ff "$@"
}
# No point in merging the first parent, that's HEAD
new_parents=${new_parents# $first_parent}
if ! do_with_author output \
- git merge ${strategy:+-s $strategy} -m \
+ git merge --no-ff ${strategy:+-s $strategy} -m \
"$msg_content" $new_parents
then
printf "%s\n" "$msg_content" > "$GIT_DIR"/MERGE_MSG
test -s "$todo" && return
comment_for_reflog finish &&
- head_name=$(cat "$state_dir"/head-name) &&
- orig_head=$(cat "$state_dir"/head) &&
- shortonto=$(git rev-parse --short $(cat "$state_dir"/onto)) &&
+ shortonto=$(git rev-parse --short $onto) &&
newhead=$(git rev-parse HEAD) &&
case $head_name in
refs/*)
;;
esac && {
test ! -f "$state_dir"/verbose ||
- git diff-tree --stat $(cat "$state_dir"/head)..HEAD
+ git diff-tree --stat $orig_head..HEAD
} &&
{
test -s "$rewritten_list" &&
die "Could not skip unnecessary pick commands"
}
-get_saved_options () {
- test -d "$rewritten" && preserve_merges=t
- test -f "$state_dir"/strategy && strategy="$(cat "$state_dir"/strategy)"
- test -f "$state_dir"/verbose && verbose=t
- test -f "$state_dir"/rebase-root && rebase_root=t
-}
-
# Rearrange the todo list that has both "pick sha1 msg" and
# "pick sha1 fixup!/squash! msg" appears in it so that the latter
# comes immediately after the former, and change "pick" to
case "$action" in
continue)
- get_saved_options
- comment_for_reflog continue
-
- # Sanity check
- git rev-parse --verify HEAD >/dev/null ||
- die "Cannot read HEAD"
- git update-index --ignore-submodules --refresh &&
- git diff-files --quiet --ignore-submodules ||
- die "Working tree is dirty"
-
# do we have anything to commit?
if git diff-index --cached --quiet --ignore-submodules HEAD --
then
require_clean_work_tree "rebase"
do_rest
;;
-abort)
- get_saved_options
- comment_for_reflog abort
-
- git rerere clear
-
- head_name=$(cat "$state_dir"/head-name)
- orig_head=$(cat "$state_dir"/head)
- case $head_name in
- refs/*)
- git symbolic-ref HEAD $head_name
- ;;
- esac &&
- output git reset --hard $orig_head &&
- rm -rf "$state_dir"
- exit
- ;;
skip)
- get_saved_options
- comment_for_reflog skip
-
git rerere clear
- output git reset --hard && do_rest
+ do_rest
;;
esac
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
-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
+write_basic_state
if test t = "$preserve_merges"
then
if test -z "$rebase_root"