-
Notifications
You must be signed in to change notification settings - Fork 101
Permit repack
command in Scalar clones
#732
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
dbced3e
294fd9b
66f6c4c
0e69b1e
9df7c2a
84f9459
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,6 +32,7 @@ | |
#define DELAY_PAGER_CONFIG (1<<4) | ||
#define NO_PARSEOPT (1<<5) /* parse-options is not used */ | ||
#define BLOCK_ON_GVFS_REPO (1<<6) /* command not allowed in GVFS repos */ | ||
#define BLOCK_ON_VFS_ENABLED (1<<7) /* command not allowed when virtual file system is used */ | ||
|
||
struct cmd_struct { | ||
const char *cmd; | ||
|
@@ -542,6 +543,9 @@ static int run_builtin(struct cmd_struct *p, int argc, const char **argv, struct | |
if (!help && p->option & BLOCK_ON_GVFS_REPO && gvfs_config_is_set(GVFS_BLOCK_COMMANDS)) | ||
die("'git %s' is not supported on a GVFS repo", p->cmd); | ||
|
||
if (!help && p->option & BLOCK_ON_VFS_ENABLED && gvfs_config_is_set(GVFS_USE_VIRTUAL_FILESYSTEM)) | ||
derrickstolee marked this conversation as resolved.
Show resolved
Hide resolved
|
||
die("'git %s' is not supported when using the virtual file system", p->cmd); | ||
|
||
if (run_pre_command_hook(the_repository, argv)) | ||
die("pre-command hook aborted command"); | ||
|
||
|
@@ -625,7 +629,7 @@ static struct cmd_struct commands[] = { | |
{ "for-each-ref", cmd_for_each_ref, RUN_SETUP }, | ||
{ "for-each-repo", cmd_for_each_repo, RUN_SETUP_GENTLY }, | ||
{ "format-patch", cmd_format_patch, RUN_SETUP }, | ||
{ "fsck", cmd_fsck, RUN_SETUP | BLOCK_ON_GVFS_REPO}, | ||
{ "fsck", cmd_fsck, RUN_SETUP | BLOCK_ON_VFS_ENABLED }, | ||
{ "fsck-objects", cmd_fsck, RUN_SETUP }, | ||
{ "fsmonitor--daemon", cmd_fsmonitor__daemon, RUN_SETUP }, | ||
{ "gc", cmd_gc, RUN_SETUP }, | ||
|
@@ -668,7 +672,7 @@ static struct cmd_struct commands[] = { | |
{ "pack-refs", cmd_pack_refs, RUN_SETUP }, | ||
{ "patch-id", cmd_patch_id, RUN_SETUP_GENTLY | NO_PARSEOPT }, | ||
{ "pickaxe", cmd_blame, RUN_SETUP }, | ||
{ "prune", cmd_prune, RUN_SETUP | BLOCK_ON_GVFS_REPO}, | ||
{ "prune", cmd_prune, RUN_SETUP | BLOCK_ON_VFS_ENABLED }, | ||
{ "prune-packed", cmd_prune_packed, RUN_SETUP }, | ||
{ "pull", cmd_pull, RUN_SETUP | NEED_WORK_TREE }, | ||
{ "push", cmd_push, RUN_SETUP }, | ||
|
@@ -681,7 +685,7 @@ static struct cmd_struct commands[] = { | |
{ "remote", cmd_remote, RUN_SETUP }, | ||
{ "remote-ext", cmd_remote_ext, NO_PARSEOPT }, | ||
{ "remote-fd", cmd_remote_fd, NO_PARSEOPT }, | ||
{ "repack", cmd_repack, RUN_SETUP | BLOCK_ON_GVFS_REPO }, | ||
{ "repack", cmd_repack, RUN_SETUP | BLOCK_ON_VFS_ENABLED }, | ||
{ "replace", cmd_replace, RUN_SETUP }, | ||
{ "replay", cmd_replay, RUN_SETUP }, | ||
{ "rerere", cmd_rerere, RUN_SETUP }, | ||
|
@@ -722,7 +726,7 @@ static struct cmd_struct commands[] = { | |
{ "verify-tag", cmd_verify_tag, RUN_SETUP }, | ||
{ "version", cmd_version }, | ||
{ "whatchanged", cmd_whatchanged, RUN_SETUP }, | ||
{ "worktree", cmd_worktree, RUN_SETUP }, | ||
{ "worktree", cmd_worktree, RUN_SETUP | BLOCK_ON_VFS_ENABLED }, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a much simpler way to do this! |
||
{ "write-tree", cmd_write_tree, RUN_SETUP }, | ||
}; | ||
|
||
|
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -22,7 +22,6 @@ not_with_gvfs fsck | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
not_with_gvfs gc | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
not_with_gvfs gc --auto | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
not_with_gvfs prune | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
not_with_gvfs repack | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
not_with_gvfs submodule status | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
not_with_gvfs update-index --index-version 2 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
not_with_gvfs update-index --skip-worktree | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
@@ -36,4 +35,14 @@ test_expect_success 'test gc --auto succeeds when disabled via config' ' | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
git gc --auto | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
test_expect_success 'test repack fails with VFS bit enabled' ' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
test_config core.gvfs true && | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
test_must_fail git repack | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
test_expect_success 'test repack succeeds with VFS bit disabled' ' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you add a test with a Scalar clone that has a It would be good to be up front about " There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
We do have this in Lines 1822 to 1831 in 5ad6dd6
I think this is part of what is verified in Lines 1126 to 1155 in 5ad6dd6
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The The There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There is an example of a similar scenario in Lines 1292 to 1302 in 5ad6dd6
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm. If I put myself into a user's shoes, I would much rather prefer There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Something like this? (for option b) diff --git a/builtin/repack.c b/builtin/repack.c
index 01db1b8f529..5a44171f8e8 100644
--- a/builtin/repack.c
+++ b/builtin/repack.c
@@ -24,6 +24,7 @@
#include "pack-bitmap.h"
#include "refs.h"
#include "list-objects-filter-options.h"
+#include "gvfs.h"
#define ALL_INTO_ONE 1
#define LOOSEN_UNREACHABLE 2
@@ -1177,6 +1178,7 @@ int cmd_repack(int argc,
struct tempfile *refs_snapshot = NULL;
int i, ext, ret;
int show_progress;
+ const char *tmp_obj_dir = NULL;
/* variables to be filled by option parsing */
int delete_redundant = 0;
@@ -1301,6 +1303,10 @@ int cmd_repack(int argc,
write_bitmaps = 0;
}
+ if (gvfs_config_is_set(NULL) &&
+ !git_config_get_value("gvfs.sharedcache", &tmp_obj_dir))
+ warning(_("shared object cache will not be repacked; use `git maintenance run --task=incremental-repack` instead"));
+
if (write_midx && write_bitmaps) {
struct strbuf path = STRBUF_INIT;
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That would be the option with the warning. However, as a user I'd much prefer the command to not warn me about something I probably don't want, but to do what I probably want instead, i.e. the other option you suggested ;-) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think users who are bothering to run |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
test_config core.gvfs 150 && | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
git repack | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
test_done |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's turn this warning into in informational message that the shared cache is repacked instead (and then do that) in a follow-up PR (and add a test to verify that it worked as intended). Unfortunately, it won't be as easy as:
because subsequent lines call
repo_get_object_repository()
(this line, this one and this one), and that function merely returns the already-initializedrepo->objects->odb->path
.Other than that, the
pack-objects
command is spawned which also would need to know about this, and the cruft pack/delete redundant part probably also would need to be updated.Most importantly, though, we really need to ensure that no objects are deleted that are reachable in any Scalar repository that shares that
sharedcache
repository, even if the objects should not be reachable in thatsharedcache
repository itself...