Skip to content

Commit 35c4a9a

Browse files
committed
fixup! maintenance: care about gvfs.sharedCache config
1 parent 5b0f528 commit 35c4a9a

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

builtin/gc.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1141,17 +1141,19 @@ static int write_loose_object_to_stdin(const struct object_id *oid,
11411141
return ++(d->count) > d->batch_size;
11421142
}
11431143

1144-
static const char *object_dir = NULL;
1144+
static const char *vfs_object_dir = NULL;
11451145

11461146
static int pack_loose(struct maintenance_run_opts *opts)
11471147
{
11481148
struct repository *r = the_repository;
11491149
int result = 0;
11501150
struct write_loose_object_data data;
11511151
struct child_process pack_proc = CHILD_PROCESS_INIT;
1152+
const char *object_dir = r->objects->odb->path;
11521153

1153-
if (!object_dir)
1154-
object_dir = r->objects->odb->path;
1154+
/* If set, use the VFS object directory. */
1155+
if (vfs_object_dir)
1156+
object_dir = vfs_object_dir;
11551157

11561158
/*
11571159
* Do not start pack-objects process
@@ -1620,8 +1622,8 @@ static int maintenance_run(int argc, const char **argv, const char *prefix)
16201622
*/
16211623
if (!git_config_get_value("gvfs.sharedcache", &tmp_obj_dir) &&
16221624
tmp_obj_dir) {
1623-
object_dir = xstrdup(tmp_obj_dir);
1624-
setenv(DB_ENVIRONMENT, object_dir, 1);
1625+
vfs_object_dir = xstrdup(tmp_obj_dir);
1626+
setenv(DB_ENVIRONMENT, vfs_object_dir, 1);
16251627
}
16261628

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

0 commit comments

Comments
 (0)