[PATCH 01/15] rebase -i: handle NULL value for rebase.missingCommitsCheck
- From
Thomas Bachem via GitGitGadget <gitgitgadget@gmail.com>
- Date
- Nov 7, 2026, 08:42 UTC
- Message-ID
- <a9a3f4b705f98f0957bc9645395f4c68875b2896.1794040967.git.gitgitgadget@gmail.com>
- In-Reply-To
- <pull.2297.git.1794040967.gitgitgadget@gmail.com>
From: Thomas Bachem <mail@thomasbachem.com>
A rebase.missingCommitsCheck without a value, as in
[rebase] missingCommitsCheck
or "git -c rebase.missingCommitsCheck", makes "git rebase -i" segfault as it writes the todo list: get_missing_commit_check_level() passes the NULL value to strcasecmp().
The setting takes "ignore", "warn" or "error", not a bool. Read it with repo_config_get_string_tmp(), which rejects a missing value with config_error_nonbool(), as ba176db511 (config: handle NULL value when parsing non-bools, 2023-12-07) did for other settings.
Assisted-by: Claude Fable 5.1 Signed-off-by: Thomas Bachem <mail@thomasbachem.com> --- rebase-interactive.c | 2 +- t/t3404-rebase-interactive.sh | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/rebase-interactive.c b/rebase-interactive.c index 809f76a87b..4eb628ee8f 100644 --- a/rebase-interactive.c +++ b/rebase-interactive.c @@ -30,7 +30,7 @@ static enum missing_commit_check_level get_missing_commit_check_level(void) { const char *value; - if (repo_config_get_value(the_repository, "rebase.missingcommitscheck", &value) || + if (repo_config_get_string_tmp(the_repository, "rebase.missingcommitscheck", &value) || !strcasecmp("ignore", value)) return MISSING_COMMIT_CHECK_IGNORE; if (!strcasecmp("warn", value)) diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh index ff11abb2f2..813ad2a83d 100755 --- a/t/t3404-rebase-interactive.sh +++ b/t/t3404-rebase-interactive.sh @@ -1562,6 +1562,13 @@ test_expect_success 'rebase -i respects rebase.missingCommitsCheck = error' ' test B = $(git cat-file commit HEAD^ | sed -ne \$p) ' +test_expect_success 'rebase -i rejects rebase.missingCommitsCheck without a value' ' + rebase_setup_and_clean missing-commit && + test_when_finished "test_might_fail git rebase --abort" && + test_must_fail git -c rebase.missingCommitsCheck rebase -i --root 2>err && + test_grep "missing value for .rebase.missingcommitscheck." err +' + test_expect_success 'rebase --edit-todo respects rebase.missingCommitsCheck = ignore' ' test_config rebase.missingCommitsCheck ignore && rebase_setup_and_clean missing-commit &&
-- gitgitgadget