legacy-rebase: backport -C<n> and --whitespace=<option> checks
Since 04519d720114 (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>
Johannes Schindelin committed
Nov 20, 2018 at 12:02 UTC
7e097e27d3a9a5a8517d8ed139dcfdb1a21fd87a
1 file changed
+8
git-legacy-rebase.sh
+8
@@ -337,6 +337,11 @@ do
337
fix|strip)
338
force_rebase=t
339
;;
340
+ warn|nowarn|error|error-all)
341
+ ;; # okay, known whitespace option
342
+ *)
343
+ die "fatal: Invalid whitespace option: '${1#*=}'"
344
+ ;;
345
esac
346
;;
347
--ignore-whitespace)
@@ -352,6 +357,9 @@ do
357
git_am_opt="$git_am_opt $1"
358
force_rebase=t
359
;;
360
+ -C*[!0-9]*)
361
+ die "fatal: switch \`C' expects a numerical value"
362
+ ;;
363
-C*)
364
git_am_opt="$git_am_opt $1"
365
;;