[GSOC][PATCH 0/2] Remove global state from editor.c
- From
Shreyansh Paliwal <shreyanshpaliwalcmsmn@gmail.com>
- Date
- Mar 1, 2026, 10:42 UTC
- Message-ID
- <20260301105228.1738388-1-shreyanshpaliwalcmsmn@gmail.com>
This series reduces reliance on global states. Mainly there are two such global states in editor.c,
* editor_program: defined in environment.c and populated during config parsing, but only used by editor.c via git_editor().
* the_repository: used in git_sequence_editor() to read the sequence.editor configuration.
In patch 1/2, localize editor_program to editor.c by introducing a helper that allows git_default_core_config() to continue initializing the value during initial config parsing.
In patch 2/2, remove the remaining use of the_repository in editor.c by passing struct repository through git_sequence_editor() and its callers. With this change, editor.c no longer requires 'USE_THE_REPOSITORY_VARIABLE'.
Shreyansh Paliwal (2): editor: make editor_program local to editor.c editor: remove the_repository usage
builtin/var.c | 2 +- editor.c | 18 ++++++++++++------ editor.h | 6 ++++-- environment.c | 5 ++--- environment.h | 1 - rebase-interactive.c | 2 +- 6 files changed, 20 insertions(+), 14 deletions(-)
-- 2.53.0