1# This shell script fragment is sourced by git-rebase to implement 2# its interactive mode. "git rebase --interactive" makes it easy 3# to fix up commits in the middle of a series and rearrange commits. 4# 5# Copyright (c) 2006 Johannes E. Schindelin 6# 7# The original idea comes from Eric W. Biederman, in 8# https://public-inbox.org/git/m1odwkyuf5.fsf_-_@ebiederm.dsl.xmission.com/ 9# 10# The file containing rebase commands, comments, and empty lines. 11# This file is created by "git rebase -i" then edited by the user. As 12# the lines are processed, they are removed from the front of this 13# file and written to the tail of $done. 14todo="$state_dir"/git-rebase-todo 15 16GIT_CHERRY_PICK_HELP="$resolvemsg" 17export GIT_CHERRY_PICK_HELP 18 19# Initiate an action. If the cannot be any 20# further action it may exec a command 21# or exit and not return. 22# 23# TODO: Consider a cleaner return model so it 24# never exits and always return 0 if process 25# is complete. 26# 27# Parameter 1 is the action to initiate. 28# 29# Returns 0 if the action was able to complete 30# and if 1 if further processing is required. 31initiate_action () { 32case"$1"in 33continue) 34exec git rebase--helper${force_rebase:+--no-ff} $allow_empty_message \ 35--continue 36;; 37 skip) 38 git rerere clear 39exec git rebase--helper${force_rebase:+--no-ff} $allow_empty_message \ 40--continue 41;; 42 edit-todo) 43exec git rebase--helper --edit-todo 44;; 45 show-current-patch) 46exec git show REBASE_HEAD -- 47;; 48*) 49return1# continue 50;; 51esac 52} 53 54git_rebase__interactive () { 55 initiate_action "$action" 56 ret=$? 57iftest$ret=0;then 58return0 59fi 60 61test -n"$keep_empty"&& keep_empty="--keep-empty" 62test -n"$rebase_merges"&& rebase_merges="--rebase-merges" 63test -n"$rebase_cousins"&& rebase_cousins="--rebase-cousins" 64test -n"$autosquash"&& autosquash="--autosquash" 65test -n"$verbose"&& verbose="--verbose" 66test -n"$force_rebase"&& force_rebase="--no-ff" 67test -n"$restrict_revisions"&& restrict_revisions="--restrict-revisions=^$restrict_revisions" 68test -n"$upstream"&& upstream="--upstream=$upstream" 69test -n"$onto"&& onto="--onto=$onto" 70test -n"$squash_onto"&& squash_onto="--squash-onto=$squash_onto" 71test -n"$onto_name"&& onto_name="--onto-name=$onto_name" 72test -n"$head_name"&& head_name="--head-name=$head_name" 73test -n"$strategy"&& strategy="--strategy=$strategy" 74test -n"$strategy_opts"&& strategy_opts="--strategy-opts=$strategy_opts" 75test -n"$switch_to"&& switch_to="--switch-to=$switch_to" 76test -n"$cmd"&& cmd="--cmd=$cmd" 77 78exec git rebase--interactive2"$keep_empty""$rebase_merges""$rebase_cousins" \ 79"$upstream""$onto""$squash_onto""$restrict_revision" \ 80"$allow_empty_message""$autosquash""$verbose" \ 81"$force_rebase""$onto_name""$head_name""$strategy" \ 82"$strategy_opts""$cmd""$switch_to" \ 83"$allow_rerere_autoupdate""$gpg_sign_opt""$signoff" 84}