diff options
| author | Ayush Chandekar <ayu.chandekar@gmail.com> | 2025-07-04 19:42:34 +0530 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2025-07-07 08:31:13 -0700 |
| commit | 44e300a97480ef272a596e02b912b72528043193 (patch) | |
| tree | 90837873d8d44102fff723593bb0f2437d7702af /builtin | |
| parent | The fourth batch (diff) | |
| download | git-44e300a97480ef272a596e02b912b72528043193.tar.gz git-44e300a97480ef272a596e02b912b72528043193.zip | |
repository: move 'repository_format_precious_objects' to repo scope
The 'extensions.preciousObjects' setting when set true, prevents
operations that might drop objects from the object storage. This setting
is populated in the global variable
'repository_format_precious_objects'.
Move this global variable to repo scope by adding it to 'struct
repository and also refactor all the occurences accordingly.
This change is part of an ongoing effort to eliminate global variables,
improve modularity and help libify the codebase.
Mentored-by: Christian Couder <christian.couder@gmail.com>
Mentored-by: Ghanshyam Thakkar <shyamthakkar001@gmail.com>
Signed-off-by: Ayush Chandekar <ayu.chandekar@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin')
| -rw-r--r-- | builtin/gc.c | 2 | ||||
| -rw-r--r-- | builtin/prune.c | 2 | ||||
| -rw-r--r-- | builtin/repack.c | 2 |
3 files changed, 3 insertions, 3 deletions
diff --git a/builtin/gc.c b/builtin/gc.c index 845876ff02..ec10b81dcc 100644 --- a/builtin/gc.c +++ b/builtin/gc.c @@ -998,7 +998,7 @@ int cmd_gc(int argc, if (opts.detach <= 0 && !skip_foreground_tasks) gc_foreground_tasks(&opts, &cfg); - if (!repository_format_precious_objects) { + if (!the_repository->repository_format_precious_objects) { struct child_process repack_cmd = CHILD_PROCESS_INIT; repack_cmd.git_cmd = 1; diff --git a/builtin/prune.c b/builtin/prune.c index e930caa0c0..dab3c19b6f 100644 --- a/builtin/prune.c +++ b/builtin/prune.c @@ -177,7 +177,7 @@ int cmd_prune(int argc, argc = parse_options(argc, argv, prefix, options, prune_usage, 0); - if (repository_format_precious_objects) + if (the_repository->repository_format_precious_objects) die(_("cannot prune in a precious-objects repo")); while (argc--) { diff --git a/builtin/repack.c b/builtin/repack.c index 5ddc6e7f95..d0e4fa6bed 100644 --- a/builtin/repack.c +++ b/builtin/repack.c @@ -1240,7 +1240,7 @@ int cmd_repack(int argc, po_args.depth = xstrdup_or_null(opt_depth); po_args.threads = xstrdup_or_null(opt_threads); - if (delete_redundant && repository_format_precious_objects) + if (delete_redundant && the_repository->repository_format_precious_objects) die(_("cannot delete packs in a precious-objects repo")); die_for_incompatible_opt3(unpack_unreachable || (pack_everything & LOOSEN_UNREACHABLE), "-A", |
