Commits

Anonymous committed cd5320f

git-rebase.sh: Add check if rebase is in progress

"git rebase --continue" and friends gave nonsense errors when there is no
rebase in progress.

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Comments (0)

Files changed (1)

 do
 	case "$1" in
 	--continue)
+		test -d "$dotest" -o -d .dotest ||
+			die "No rebase in progress?"
+
 		git diff-files --quiet --ignore-submodules || {
 			echo "You must edit all merge conflicts and then"
 			echo "mark them as resolved using git add"
 		exit
 		;;
 	--skip)
+		test -d "$dotest" -o -d .dotest ||
+			die "No rebase in progress?"
+
 		git reset --hard HEAD || exit $?
 		if test -d "$dotest"
 		then
 		exit
 		;;
 	--abort)
+		test -d "$dotest" -o -d .dotest ||
+			die "No rebase in progress?"
+
 		git rerere clear
 		if test -d "$dotest"
 		then
 			move_to_original_branch
-		elif test -d .dotest
-		then
+		else
 			dotest=.dotest
 			move_to_original_branch
-		else
-			die "No rebase in progress?"
 		fi
 		git reset --hard $(cat "$dotest/orig-head")
 		rm -r "$dotest"
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.