legacy-rebase: backport -C<n> and --whitespace=<option> checks

Since 04519d7201 (rebase: validate -C<n> and --whitespace=<mode>
parameters early, 2018-11-14), the built-in rebase validates the -C and
--whitespace arguments early. As this commit also introduced a
regression test for this, and as a later commit introduced the
GIT_TEST_REBASE_USE_BUILTIN mode to run tests, we now have a
"regression" in the scripted version of `git rebase` on our hands.

Backport the validation to fix this.

Reported-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Johannes Schindelin 2018-11-20 12:02:01 -08:00 committed by Junio C Hamano
parent 04519d7201
commit 7e097e27d3

View file

@ -337,6 +337,11 @@ do
fix|strip) fix|strip)
force_rebase=t force_rebase=t
;; ;;
warn|nowarn|error|error-all)
;; # okay, known whitespace option
*)
die "fatal: Invalid whitespace option: '${1#*=}'"
;;
esac esac
;; ;;
--ignore-whitespace) --ignore-whitespace)
@ -352,6 +357,9 @@ do
git_am_opt="$git_am_opt $1" git_am_opt="$git_am_opt $1"
force_rebase=t force_rebase=t
;; ;;
-C*[!0-9]*)
die "fatal: switch \`C' expects a numerical value"
;;
-C*) -C*)
git_am_opt="$git_am_opt $1" git_am_opt="$git_am_opt $1"
;; ;;