@@ -22,6 +22,7 @@ p= pass it through git-apply
2222resolvemsg= override error message when patch failure occurs
2323r,resolved to be used after a patch failure
2424skip skip the current patch
25+ abort restore the original branch and abort the patching operation.
2526rebasing (internal use for git-rebase)"
2627
2728. git-sh-setup
@@ -54,6 +55,7 @@ stop_here_user_resolve () {
5455 fi
5556 echo " When you have resolved this problem run \" $cmdline --resolved\" ."
5657 echo " If you would prefer to skip this patch, instead run \" $cmdline --skip\" ."
58+ echo " To restore the original branch and stop patching run \" $cmdline --abort\" ."
5759
5860 stop_here $1
5961}
@@ -120,7 +122,7 @@ It does not apply to blobs recorded in its index."
120122
121123prec=4
122124dotest=" $GIT_DIR /rebase"
123- sign= utf8=t keep= skip= interactive= resolved= binary= rebasing=
125+ sign= utf8=t keep= skip= interactive= resolved= binary= rebasing= abort=
124126resolvemsg= resume=
125127git_apply_opt=
126128
145147 resolved=t ;;
146148 --skip)
147149 skip=t ;;
150+ --abort)
151+ abort=t ;;
148152 --rebasing)
149153 rebasing=t threeway=t keep=t binary=t ;;
150154 -d|--dotest)
177181
178182if test -d " $dotest "
179183then
180- case " $# ,$skip$resolved " in
184+ case " $# ,$skip$resolved$abort " in
181185 0,* t* )
182186 # Explicit resume command and we do not have file, so
183187 # we are happy.
@@ -197,9 +201,18 @@ then
197201 esac ||
198202 die " previous rebase directory $dotest still exists but mbox given."
199203 resume=yes
204+
205+ case " $abort " in
206+ t)
207+ git rerere clear
208+ git read-tree --reset -u HEAD ORIG_HEAD
209+ git reset ORIG_HEAD
210+ rm -fr " $dotest "
211+ exit ;;
212+ esac
200213else
201- # Make sure we are not given --skip nor --resolved
202- test " , $skip , $resolved , " = ,,, ||
214+ # Make sure we are not given --skip, --resolved, nor --abort
215+ test " $skip$resolved$abort " = " " ||
203216 die " Resolve operation not in progress, we are not resuming."
204217
205218 # Start afresh.
0 commit comments