Skip to content

Commit ee8f79c

Browse files
mjcheethamdscho
authored andcommitted
fixup! maintenance: care about gvfs.sharedCache config
1 parent ba48074 commit ee8f79c

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

Diff for: builtin/gc.c

+7-5
Original file line numberDiff line numberDiff line change
@@ -1154,17 +1154,19 @@ static int write_loose_object_to_stdin(const struct object_id *oid,
11541154
return ++(d->count) > d->batch_size;
11551155
}
11561156

1157-
static const char *object_dir = NULL;
1157+
static const char *shared_object_dir = NULL;
11581158

11591159
static int pack_loose(struct maintenance_run_opts *opts)
11601160
{
11611161
struct repository *r = the_repository;
11621162
int result = 0;
11631163
struct write_loose_object_data data;
11641164
struct child_process pack_proc = CHILD_PROCESS_INIT;
1165+
const char *object_dir = r->objects->odb->path;
11651166

1166-
if (!object_dir)
1167-
object_dir = r->objects->odb->path;
1167+
/* If set, use the shared object directory. */
1168+
if (shared_object_dir)
1169+
object_dir = shared_object_dir;
11681170

11691171
/*
11701172
* Do not start pack-objects process
@@ -1634,8 +1636,8 @@ static int maintenance_run(int argc, const char **argv, const char *prefix,
16341636
*/
16351637
if (!git_config_get_value("gvfs.sharedcache", &tmp_obj_dir) &&
16361638
tmp_obj_dir) {
1637-
object_dir = xstrdup(tmp_obj_dir);
1638-
setenv(DB_ENVIRONMENT, object_dir, 1);
1639+
shared_object_dir = xstrdup(tmp_obj_dir);
1640+
setenv(DB_ENVIRONMENT, shared_object_dir, 1);
16391641
}
16401642

16411643
ret = maintenance_run_tasks(&opts, &cfg);

0 commit comments

Comments
 (0)