Open
Conversation
The `core.attributeFile` config value is parsed in git_default_core_config(), loaded eagerly and stored in the global variable `git_attributes_file`. Storing this value in a global variable can lead to it being overwritten by another repository when more than one Git repository run in the same Git process. Create a new struct `repo_config_values` to hold this value and other repository dependent values parsed by `git_default_config()`. This will ensure the current behaviour remains the same while also enabling the libification of Git. An accessor function 'repo_config_values()' s created to ensure that we do not access an uninitialized repository, or an instance of a different repository than the current one. Suggested-by: Phillip Wood <phillip.wood123@gmail.com> Mentored-by: Christian Couder <christian.couder@gmail.com> Mentored-by: Usman Akinyemi <usmanakinyemi202@gmail.com> Helped-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Olamide Caleb Bello <belkid98@gmail.com>
The config value `core.sparseCheckout` is parsed in `git_default_core_config()` and stored globally in `core_apply_sparse_checkout`. This could cause it to be overwritten by another repository when different Git repositories run in the same process. Move the parsed value into `struct repo_config_values` in the_repository to retain current behaviours and move towards libifying Git. Suggested-by: Phillip Wood <phillip.wood123@gmail.com> Mentored-by: Christian Couder <christian.couder@gmail.com> Mentored-by: Usman Akinyemi <usmanakinyemi202@gmail.com> Signed-off-by: Olamide Caleb Bello <belkid98@gmail.com>
…lues` The config value `branch.autoSetupMerge` is parsed in `git_default_branch_config()` and stored in the global variable `git_branch_track`. This global variable can be overwritten by another repository when multiple Git repos run in the the same process. Move this value into `struct repo_config_values` in the_repository to retain current behaviours and move towards libifying Git. Since the variable is no longer a global variable, it has been renamed to `branch_track` in the struct `repo_config_values`. Suggested-by: Phillip Wood <phillip.wood123@gmail.com> Mentored-by: Christian Couder <christian.couder@gmail.com> Mentored-by: Usman Akinyemi <usmanakinyemi202@gmail.com> Signed-off-by: Olamide Caleb Bello <belkid98@gmail.com>
To pave the way for reducing the global state tied to commit encoding in a subsequent patch, functions like 'commit_tree()' and 'commit_tree_extended()' must be able to access a repository instance. Plumb the 'struct repository' pointer down the call chain for these APIs. For built-ins or subsystems already dependent on global state (e.g., 'notes_cache_write()'), fallback to 'the_repository'. No functional changes are introduced in this preparatory step. Signed-off-by: Tian Yuchen <a3205153416@gmail.com>
To prepare for the elimination of the global state associated with 'log_output_encoding', functions responsible for formatting commit messages, such as 'pretty_print_commit()' and 'pp_commit_easy()', must be able to access a repository instance. Plumb the 'struct repository' pointer down the call chain for these APIs. Where no such context is readily available in built-ins or high-level functions, fallback to 'the_repository'. Signed-off-by: Tian Yuchen <a3205153416@gmail.com>
The global variables 'git_commit_encoding' and 'git_log_output_encoding' prevent libification. Migrate these variables into the 'struct repo_config_values'. This ensures that they are safely accessed via the 'repo_config_values()' accessor which prevents uninitialized or cross-repository access. Note that these variables are not migrated to 'repo_settings'. As eagerly parsed user preferences, deferring them to lazy evaluation would break early validation. Currently, during the config parsing phase in 'git_default_i18n_config()', the values are still parsed into the 'the_repository' instance of 'repo_config_values', Since safely plumbing a repository pointer through the 'git_default_config' callback machinery remains highly invasive due to custom contexts being passed via the 'void *cb' parameter. However, the read-paths (commit APIs and log formatters) updated in previous patches are now fully plumbed to accept any repository instance. Signed-off-by: Tian Yuchen <a3205153416@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.