git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 1/1] legacy-rebase: backport -C<n> and --whitespace=<option> checks

From
Johannes Schindelin via GitGitGadget <gitgitgadget@gmail.com>
Date
Nov 20, 2018, 20:02 UTC
Message-ID
<84e65a4efb3d58ca777cd59c52fe86d63060ea9e.1542744118.git.gitgitgadget@gmail.com>
In-Reply-To
<pull.86.git.gitgitgadget@gmail.com>
From: Johannes Schindelin <johannes.schindelin@gmx.de>

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>
---
 git-legacy-rebase.sh | 8 ++++++++
 1 file changed, 8 insertions(+)
diff --git a/git-legacy-rebase.sh b/git-legacy-rebase.sh
index 75a08b2683..ced0635326 100755
--- a/git-legacy-rebase.sh
+++ b/git-legacy-rebase.sh
@@ -337,6 +337,11 @@ do
 		fix|strip)
 			force_rebase=t
 			;;
+		warn|nowarn|error|error-all)
+			;; # okay, known whitespace option
+		*)
+			die "Invalid whitespace option: '${1%*=}'"
+			;;
 		esac
 		;;
 	--ignore-whitespace)
@@ -352,6 +357,9 @@ do
 		git_am_opt="$git_am_opt $1"
 		force_rebase=t
 		;;
+	-C*[!0-9]*)
+		die "switch \`C' expects a numerical value"
+		;;
 	-C*)
 		git_am_opt="$git_am_opt $1"
 		;;
-- 
gitgitgadget
Previous: Johannes Schindelin via GitGitGadgetNext: Carlo Arenas
Message 2 of 5 in “legacy-rebase: fix "regression"”
  1. 0/1 legacy-rebase: fix "regression"Johannes Schindelin via GitGitGadget, Nov 20, 2018
  2. 1/1 legacy-rebase: backport -C<n> and --whitespace=<option> checksJohannes Schindelin via GitGitGadget, Nov 20, 2018
  3. Carlo ArenasNov 20, 2018
  4. Junio C HamanoNov 21, 2018
  5. Johannes SchindelinNov 21, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.