]> git.ipfire.org Git - thirdparty/git.git/blobdiff - git-rebase--preserve-merges.sh
Merge branch 'en/strmap'
[thirdparty/git.git] / git-rebase--preserve-merges.sh
index c214c5e4d6ce21996f16031ec14dd624b75a9939..b9c71d2a71bdd32ed595da0d217f1e6c854f5ffc 100644 (file)
@@ -77,6 +77,61 @@ rewritten_pending="$state_dir"/rewritten-pending
 # and leaves CR at the end instead.
 cr=$(printf "\015")
 
+resolvemsg="
+$(gettext 'Resolve all conflicts manually, mark them as resolved with
+"git add/rm <conflicted_files>", then run "git rebase --continue".
+You can instead skip this commit: run "git rebase --skip".
+To abort and get back to the state before "git rebase", run "git rebase --abort".')
+"
+
+write_basic_state () {
+       echo "$head_name" > "$state_dir"/head-name &&
+       echo "$onto" > "$state_dir"/onto &&
+       echo "$orig_head" > "$state_dir"/orig-head &&
+       test t = "$GIT_QUIET" && : > "$state_dir"/quiet
+       test t = "$verbose" && : > "$state_dir"/verbose
+       test -n "$strategy" && echo "$strategy" > "$state_dir"/strategy
+       test -n "$strategy_opts" && echo "$strategy_opts" > \
+               "$state_dir"/strategy_opts
+       test -n "$allow_rerere_autoupdate" && echo "$allow_rerere_autoupdate" > \
+               "$state_dir"/allow_rerere_autoupdate
+       test -n "$gpg_sign_opt" && echo "$gpg_sign_opt" > "$state_dir"/gpg_sign_opt
+       test -n "$signoff" && echo "$signoff" >"$state_dir"/signoff
+       test -n "$reschedule_failed_exec" && : > "$state_dir"/reschedule-failed-exec
+}
+
+apply_autostash () {
+       if test -f "$state_dir/autostash"
+       then
+               stash_sha1=$(cat "$state_dir/autostash")
+               if git stash apply $stash_sha1 >/dev/null 2>&1
+               then
+                       echo "$(gettext 'Applied autostash.')" >&2
+               else
+                       git stash store -m "autostash" -q $stash_sha1 ||
+                       die "$(eval_gettext "Cannot store \$stash_sha1")"
+                       gettext 'Applying autostash resulted in conflicts.
+Your changes are safe in the stash.
+You can run "git stash pop" or "git stash drop" at any time.
+' >&2
+               fi
+       fi
+}
+
+output () {
+       case "$verbose" in
+       '')
+               output=$("$@" 2>&1 )
+               status=$?
+               test $status != 0 && printf "%s\n" "$output"
+               return $status
+               ;;
+       *)
+               "$@"
+               ;;
+       esac
+}
+
 strategy_args=${strategy:+--strategy=$strategy}
 test -n "$strategy_opts" &&
 eval '
@@ -138,16 +193,6 @@ mark_action_done () {
        fi
 }
 
-# Put the last action marked done at the beginning of the todo list
-# again. If there has not been an action marked done yet, leave the list of
-# items on the todo list unchanged.
-reschedule_last_action () {
-       tail -n 1 "$done" | cat - "$todo" >"$todo".new
-       sed -e \$d <"$done" >"$done".new
-       mv -f "$todo".new "$todo"
-       mv -f "$done".new "$done"
-}
-
 append_todo_help () {
        gettext "
 Commands:
@@ -711,11 +756,11 @@ do_rest () {
 }
 
 expand_todo_ids() {
-       git rebase--helper --expand-ids
+       git rebase--interactive --expand-ids
 }
 
 collapse_todo_ids() {
-       git rebase--helper --shorten-ids
+       git rebase--interactive --shorten-ids
 }
 
 # Switch to the branch in $into and notify it in the reflog
@@ -876,8 +921,8 @@ init_revisions_and_shortrevisions () {
 
 complete_action() {
        test -s "$todo" || echo noop >> "$todo"
-       test -z "$autosquash" || git rebase--helper --rearrange-squash || exit
-       test -n "$cmd" && git rebase--helper --add-exec-commands "$cmd"
+       test -z "$autosquash" || git rebase--interactive --rearrange-squash || exit
+       test -n "$cmd" && git rebase--interactive --add-exec-commands --cmd "$cmd"
 
        todocount=$(git stripspace --strip-comments <"$todo" | wc -l)
        todocount=${todocount##* }
@@ -912,7 +957,7 @@ However, if you remove everything, the rebase will be aborted.
        has_action "$todo" ||
                return 2
 
-       git rebase--helper --check-todo-list || {
+       git rebase--interactive --check-todo-list || {
                ret=$?
                checkout_onto
                exit $ret