Skip to content

Commit 22e962e

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 <mjcheetham@outlook.com>
1 parent 414949f commit 22e962e

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

builtin/repack.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include "promisor-remote.h"
1616
#include "repack.h"
1717
#include "shallow.h"
18+
#include "gvfs.h"
1819

1920
#define ALL_INTO_ONE 1
2021
#define LOOSEN_UNREACHABLE 2
@@ -110,6 +111,7 @@ int cmd_repack(int argc,
110111
struct tempfile *refs_snapshot = NULL;
111112
int i, ret;
112113
int show_progress;
114+
const char *tmp_obj_dir = NULL;
113115

114116
/* variables to be filled by option parsing */
115117
struct repack_config_ctx config_ctx;
@@ -244,6 +246,10 @@ int cmd_repack(int argc,
244246
write_bitmaps = 0;
245247
}
246248

249+
if (gvfs_config_is_set(repo, GVFS_ANY_MASK) &&
250+
!repo_config_get_value(repo, "gvfs.sharedcache", &tmp_obj_dir))
251+
warning(_("shared object cache is configured but will not be repacked"));
252+
247253
if (write_midx && write_bitmaps) {
248254
struct strbuf path = STRBUF_INIT;
249255

gvfs.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ struct repository;
2929
#define GVFS_FETCH_SKIP_REACHABILITY_AND_UPLOADPACK (1 << 4)
3030
#define GVFS_BLOCK_FILTERS_AND_EOL_CONVERSIONS (1 << 6)
3131

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

0 commit comments

Comments
 (0)