You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
environment: move access to "core.sparsecheckout" into repo_settings
The setting "core.sparsecheckout" is stored in the global
`core_apply_sparse_checkout` and is populated in config.c. Refactor the
code to store it in the variable `sparse_checkout` in the struct
`repo_settings`.
Call `prepare_repo_settings()` where necessary to ensure the `struct
repo_settings` is initialized before use:
- In "builtin/backfill.c", "builtin/mv.c" and "builtin/clone.c" call
`prepare_repo_settings()` since their respective `cmd_*()` functions
did not call it earlier.
- In "dir.c", the function using 'settings.sparse_checkout' is invoked
in multiple files that do not call `prepare_repo_settings()`, hence
add a call directly to that function.
- In "sparse-checkout.c", add a call to `prepare_repo_settings()` inside
`is_sparse_index_allowed()`, as it is used widely and relies on the
setting.
- In "wt-status.c", call `prepare_repo_settings()` before accessing
the setting because the function using it is commonly used.
Avoid reduntant calls to `prepare_repo_settings()` where it is already
present:
- In "builtin/worktree.c", it is already invoked in `cmd_worktree()`
before the setting is accessed.
- In "unpack-tress.c", the function accessing the setting already calls
it.
This also allows us to remove the definition `#define
USE_THE_REPOSITORY_VARIABLE` from the file 'builtin/backfill.c'.
This change is part of an ongoing effort to eliminate global variables,
improve modularity and help libify the codebase.
Mentored-by: Christian Couder <[email protected]>
Mentored-by: Ghanshyam Thakkar <[email protected]>
Signed-off-by: Ayush Chandekar <[email protected]>
Signed-off-by: Junio C Hamano <[email protected]>
0 commit comments