11#include "builtin.h"
2+ #include "gvfs.h"
23#include "config.h"
34#include "exec-cmd.h"
45#include "help.h"
1819#define SUPPORT_SUPER_PREFIX (1<<4)
1920#define DELAY_PAGER_CONFIG (1<<5)
2021#define NO_PARSEOPT (1<<6) /* parse-options is not used */
22+ #define BLOCK_ON_GVFS_REPO (1<<7) /* command not allowed in GVFS repos */
2123
2224struct cmd_struct {
2325 const char * cmd ;
@@ -511,6 +513,9 @@ static int run_builtin(struct cmd_struct *p, int argc, const char **argv)
511513 if (!help && p -> option & NEED_WORK_TREE )
512514 setup_work_tree ();
513515
516+ if (!help && p -> option & BLOCK_ON_GVFS_REPO && gvfs_config_is_set (GVFS_BLOCK_COMMANDS ))
517+ die ("'git %s' is not supported on a GVFS repo" , p -> cmd );
518+
514519 if (run_pre_command_hook (argv ))
515520 die ("pre-command hook aborted command" );
516521
@@ -595,7 +600,7 @@ static struct cmd_struct commands[] = {
595600 { "for-each-ref" , cmd_for_each_ref , RUN_SETUP },
596601 { "for-each-repo" , cmd_for_each_repo , RUN_SETUP_GENTLY },
597602 { "format-patch" , cmd_format_patch , RUN_SETUP },
598- { "fsck" , cmd_fsck , RUN_SETUP },
603+ { "fsck" , cmd_fsck , RUN_SETUP | BLOCK_ON_GVFS_REPO },
599604 { "fsck-objects" , cmd_fsck , RUN_SETUP },
600605 { "fsmonitor--daemon" , cmd_fsmonitor__daemon , RUN_SETUP },
601606 { "gc" , cmd_gc , RUN_SETUP },
@@ -635,7 +640,7 @@ static struct cmd_struct commands[] = {
635640 { "pack-refs" , cmd_pack_refs , RUN_SETUP },
636641 { "patch-id" , cmd_patch_id , RUN_SETUP_GENTLY | NO_PARSEOPT },
637642 { "pickaxe" , cmd_blame , RUN_SETUP },
638- { "prune" , cmd_prune , RUN_SETUP },
643+ { "prune" , cmd_prune , RUN_SETUP | BLOCK_ON_GVFS_REPO },
639644 { "prune-packed" , cmd_prune_packed , RUN_SETUP },
640645 { "pull" , cmd_pull , RUN_SETUP | NEED_WORK_TREE },
641646 { "push" , cmd_push , RUN_SETUP },
@@ -648,7 +653,7 @@ static struct cmd_struct commands[] = {
648653 { "remote" , cmd_remote , RUN_SETUP },
649654 { "remote-ext" , cmd_remote_ext , NO_PARSEOPT },
650655 { "remote-fd" , cmd_remote_fd , NO_PARSEOPT },
651- { "repack" , cmd_repack , RUN_SETUP },
656+ { "repack" , cmd_repack , RUN_SETUP | BLOCK_ON_GVFS_REPO },
652657 { "replace" , cmd_replace , RUN_SETUP },
653658 { "rerere" , cmd_rerere , RUN_SETUP },
654659 { "reset" , cmd_reset , RUN_SETUP },
@@ -668,7 +673,7 @@ static struct cmd_struct commands[] = {
668673 { "stash" , cmd_stash , RUN_SETUP | NEED_WORK_TREE },
669674 { "status" , cmd_status , RUN_SETUP | NEED_WORK_TREE },
670675 { "stripspace" , cmd_stripspace },
671- { "submodule--helper" , cmd_submodule__helper , RUN_SETUP | SUPPORT_SUPER_PREFIX | NO_PARSEOPT },
676+ { "submodule--helper" , cmd_submodule__helper , RUN_SETUP | SUPPORT_SUPER_PREFIX | NO_PARSEOPT | BLOCK_ON_GVFS_REPO },
672677 { "switch" , cmd_switch , RUN_SETUP | NEED_WORK_TREE },
673678 { "symbolic-ref" , cmd_symbolic_ref , RUN_SETUP },
674679 { "tag" , cmd_tag , RUN_SETUP | DELAY_PAGER_CONFIG },
@@ -686,7 +691,7 @@ static struct cmd_struct commands[] = {
686691 { "verify-tag" , cmd_verify_tag , RUN_SETUP },
687692 { "version" , cmd_version },
688693 { "whatchanged" , cmd_whatchanged , RUN_SETUP },
689- { "worktree" , cmd_worktree , RUN_SETUP | NO_PARSEOPT },
694+ { "worktree" , cmd_worktree , RUN_SETUP | NO_PARSEOPT | BLOCK_ON_GVFS_REPO },
690695 { "write-tree" , cmd_write_tree , RUN_SETUP },
691696};
692697
0 commit comments