Skip to content

Commit 24ee85e

Browse files
mjcheethamdscho
authored andcommitted
builtin/repack.c: emit warning when shared cache is present
Emit a warning message when the `gvfs.sharedCache` option is set that the `repack` command will not perform repacking on the shared cache. In the future we can teach `repack` to operate on the shared cache, at which point we can drop this commit. Signed-off-by: Matthew John Cheetham <[email protected]>
1 parent f8208e9 commit 24ee85e

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

builtin/repack.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include "pack-bitmap.h"
2525
#include "refs.h"
2626
#include "list-objects-filter-options.h"
27+
#include "gvfs.h"
2728

2829
#define ALL_INTO_ONE 1
2930
#define LOOSEN_UNREACHABLE 2
@@ -1243,7 +1244,7 @@ static const char *find_pack_prefix(const char *packdir, const char *packtmp)
12431244
int cmd_repack(int argc,
12441245
const char **argv,
12451246
const char *prefix,
1246-
struct repository *repo UNUSED)
1247+
struct repository *repo)
12471248
{
12481249
struct child_process cmd = CHILD_PROCESS_INIT;
12491250
struct string_list_item *item;
@@ -1255,6 +1256,7 @@ int cmd_repack(int argc,
12551256
int show_progress;
12561257
char **midx_pack_names = NULL;
12571258
size_t midx_pack_names_nr = 0;
1259+
const char *tmp_obj_dir = NULL;
12581260

12591261
/* variables to be filled by option parsing */
12601262
int delete_redundant = 0;
@@ -1384,6 +1386,10 @@ int cmd_repack(int argc,
13841386
write_bitmaps = 0;
13851387
}
13861388

1389+
if (gvfs_config_is_set(repo, GVFS_ANY_MASK) &&
1390+
!repo_config_get_value(repo, "gvfs.sharedcache", &tmp_obj_dir))
1391+
warning(_("shared object cache is configured but will not be repacked"));
1392+
13871393
if (write_midx && write_bitmaps) {
13881394
struct strbuf path = STRBUF_INIT;
13891395

gvfs.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ struct repository;
3030
#define GVFS_BLOCK_FILTERS_AND_EOL_CONVERSIONS (1 << 6)
3131
#define GVFS_PREFETCH_DURING_FETCH (1 << 7)
3232

33+
#define GVFS_ANY_MASK 0xFFFFFFFF
34+
3335
int gvfs_config_is_set(struct repository *r, int mask);
3436
int gvfs_virtualize_objects(struct repository *r);
3537

0 commit comments

Comments
 (0)