threads / discuss / 64424

[Outreachy] - Proposal Submission for Refactor in order to reduce Git’s global state

Subject: [Outreachy] - Proposal Submission for Refactor in order to reduce Git’s global state

## tl;dr

One message between Nov 3, 2025 and Nov 3, 2025.

replies: 0people: 1as markdown or json

Solomon Akpuru· Nov 3, 2025, 14:22 UTC · lore

Personal Bio Name Solomon (Solly) Akpuru GitHub github.com/solobarine Portfolio solobarine.netlify.app _______________________________

Overview

The Git codebase currently contains several global variables, particularly in environment.c, that govern configuration and runtime state. This architecture makes it harder to reason about concurrent repository operations and limits scalability toward multi-repository support.

This project aims to refactor environment.c to reduce its global state by migrating relevant environment and configuration variables into struct repository or struct repository_settings. This will improve code maintainability, make the behavior more predictable, and pave the way for better isolation across repositories. ________________________________

Motivation

Reducing global state is a long-standing architectural goal within Git. It improves testability, reduces hidden side effects, and allows multiple repositories to coexist in a single process safely — an increasingly important concern for complex integrations and GUI clients.

The project continues the ongoing modernization efforts within Git’s environment and configuration management, aligning with recent patches that relocated configuration options from global to repository-local contexts. ________________________________

Technical Goals
Audit global variables in environment.c and related modules.

Identify variables suitable for migration into struct repository or struct repository_settings.

Implement refactors ensuring all code paths properly initialize and reference the repository-local state.

Maintain full compatibility with existing functionality.
Update and extend the test suite to cover modified logic.

Document the architectural rationale and the migration steps for future contributors.

________________________________
Methodology

Study prior commits where similar refactoring was done (e.g., environment and config-related globals).

Use static analysis and grep-based search to identify read/write access patterns.

Refactor incrementally, submitting each migration as an independent patch series.

Collaborate actively on the Git mailing list, incorporating reviewer feedback promptly.

Rely on Git’s existing CI/test infrastructure to validate changes. ________________________________

Project Timeline: Dec 8 – Dec 21, 2025 Studying environment.c, mapping globals Dec 22 – Jan 4, 2026 Implementing and submitting first patch series Jan 5 – Feb 1, 2026 Extending refactors, handling interdependencies Feb 2 – Feb 15, 2026 Testing, documentation, and refinement Feb 16 – Mar 6, 2026 Final submission and wrap-up ________________________________

Expected Outcome
Significant reduction of global variables in Git’s environment handling.
Cleaner, more modular architecture for configuration and runtime data.
Improved multi-repository handling capability.
Comprehensive documentation and test coverage to support future contributors.

← back to recent threads