11#include "builtin.h"
2+ #include "gvfs.h"
23#include "config.h"
34#include "exec-cmd.h"
45#include "help.h"
1920#define SUPPORT_SUPER_PREFIX (1<<4)
2021#define DELAY_PAGER_CONFIG (1<<5)
2122#define NO_PARSEOPT (1<<6) /* parse-options is not used */
23+ #define BLOCK_ON_GVFS_REPO (1<<7) /* command not allowed in GVFS repos */
2224
2325struct cmd_struct {
2426 const char * cmd ;
@@ -521,6 +523,9 @@ static int run_builtin(struct cmd_struct *p, int argc, const char **argv)
521523 if (!help && p -> option & NEED_WORK_TREE )
522524 setup_work_tree ();
523525
526+ if (!help && p -> option & BLOCK_ON_GVFS_REPO && gvfs_config_is_set (GVFS_BLOCK_COMMANDS ))
527+ die ("'git %s' is not supported on a GVFS repo" , p -> cmd );
528+
524529 if (run_pre_command_hook (argv ))
525530 die ("pre-command hook aborted command" );
526531
@@ -606,7 +611,7 @@ static struct cmd_struct commands[] = {
606611 { "for-each-ref" , cmd_for_each_ref , RUN_SETUP },
607612 { "for-each-repo" , cmd_for_each_repo , RUN_SETUP_GENTLY },
608613 { "format-patch" , cmd_format_patch , RUN_SETUP },
609- { "fsck" , cmd_fsck , RUN_SETUP },
614+ { "fsck" , cmd_fsck , RUN_SETUP | BLOCK_ON_GVFS_REPO },
610615 { "fsck-objects" , cmd_fsck , RUN_SETUP },
611616 { "fsmonitor--daemon" , cmd_fsmonitor__daemon , SUPPORT_SUPER_PREFIX | RUN_SETUP },
612617 { "gc" , cmd_gc , RUN_SETUP },
@@ -647,7 +652,7 @@ static struct cmd_struct commands[] = {
647652 { "pack-refs" , cmd_pack_refs , RUN_SETUP },
648653 { "patch-id" , cmd_patch_id , RUN_SETUP_GENTLY | NO_PARSEOPT },
649654 { "pickaxe" , cmd_blame , RUN_SETUP },
650- { "prune" , cmd_prune , RUN_SETUP },
655+ { "prune" , cmd_prune , RUN_SETUP | BLOCK_ON_GVFS_REPO },
651656 { "prune-packed" , cmd_prune_packed , RUN_SETUP },
652657 { "pull" , cmd_pull , RUN_SETUP | NEED_WORK_TREE },
653658 { "push" , cmd_push , RUN_SETUP },
@@ -659,7 +664,7 @@ static struct cmd_struct commands[] = {
659664 { "remote" , cmd_remote , RUN_SETUP },
660665 { "remote-ext" , cmd_remote_ext , NO_PARSEOPT },
661666 { "remote-fd" , cmd_remote_fd , NO_PARSEOPT },
662- { "repack" , cmd_repack , RUN_SETUP },
667+ { "repack" , cmd_repack , RUN_SETUP | BLOCK_ON_GVFS_REPO },
663668 { "replace" , cmd_replace , RUN_SETUP },
664669 { "rerere" , cmd_rerere , RUN_SETUP },
665670 { "reset" , cmd_reset , RUN_SETUP },
@@ -679,7 +684,7 @@ static struct cmd_struct commands[] = {
679684 { "stash" , cmd_stash , RUN_SETUP | NEED_WORK_TREE },
680685 { "status" , cmd_status , RUN_SETUP | NEED_WORK_TREE },
681686 { "stripspace" , cmd_stripspace },
682- { "submodule--helper" , cmd_submodule__helper , RUN_SETUP | SUPPORT_SUPER_PREFIX | NO_PARSEOPT },
687+ { "submodule--helper" , cmd_submodule__helper , RUN_SETUP | SUPPORT_SUPER_PREFIX | NO_PARSEOPT | BLOCK_ON_GVFS_REPO },
683688 { "switch" , cmd_switch , RUN_SETUP | NEED_WORK_TREE },
684689 { "symbolic-ref" , cmd_symbolic_ref , RUN_SETUP },
685690 { "tag" , cmd_tag , RUN_SETUP | DELAY_PAGER_CONFIG },
@@ -697,7 +702,7 @@ static struct cmd_struct commands[] = {
697702 { "verify-tag" , cmd_verify_tag , RUN_SETUP },
698703 { "version" , cmd_version },
699704 { "whatchanged" , cmd_whatchanged , RUN_SETUP },
700- { "worktree" , cmd_worktree , RUN_SETUP },
705+ { "worktree" , cmd_worktree , RUN_SETUP | BLOCK_ON_GVFS_REPO },
701706 { "write-tree" , cmd_write_tree , RUN_SETUP },
702707};
703708
0 commit comments