55#include "run-command.h"
66#include "alias.h"
77#include "dir.h"
8+ #include "gvfs.h"
89
910#define RUN_SETUP (1<<0)
1011#define RUN_SETUP_GENTLY (1<<1)
1718#define SUPPORT_SUPER_PREFIX (1<<4)
1819#define DELAY_PAGER_CONFIG (1<<5)
1920#define NO_PARSEOPT (1<<6) /* parse-options is not used */
21+ #define BLOCK_ON_GVFS_REPO (1<<7) /* command not allowed in GVFS repos */
2022
2123struct cmd_struct {
2224 const char * cmd ;
@@ -475,6 +477,9 @@ static int run_builtin(struct cmd_struct *p, int argc, const char **argv)
475477 if (!help && p -> option & NEED_WORK_TREE )
476478 setup_work_tree ();
477479
480+ if (!help && p -> option & BLOCK_ON_GVFS_REPO && gvfs_config_is_set (GVFS_BLOCK_COMMANDS ))
481+ die ("'git %s' is not supported on a GVFS repo" , p -> cmd );
482+
478483 if (run_pre_command_hook (argv ))
479484 die ("pre-command hook aborted command" );
480485
@@ -547,7 +552,7 @@ static struct cmd_struct commands[] = {
547552 { "fmt-merge-msg" , cmd_fmt_merge_msg , RUN_SETUP },
548553 { "for-each-ref" , cmd_for_each_ref , RUN_SETUP },
549554 { "format-patch" , cmd_format_patch , RUN_SETUP },
550- { "fsck" , cmd_fsck , RUN_SETUP },
555+ { "fsck" , cmd_fsck , RUN_SETUP | BLOCK_ON_GVFS_REPO },
551556 { "fsck-objects" , cmd_fsck , RUN_SETUP },
552557 { "gc" , cmd_gc , RUN_SETUP },
553558 { "get-tar-commit-id" , cmd_get_tar_commit_id , NO_PARSEOPT },
@@ -585,7 +590,7 @@ static struct cmd_struct commands[] = {
585590 { "pack-refs" , cmd_pack_refs , RUN_SETUP },
586591 { "patch-id" , cmd_patch_id , RUN_SETUP_GENTLY | NO_PARSEOPT },
587592 { "pickaxe" , cmd_blame , RUN_SETUP },
588- { "prune" , cmd_prune , RUN_SETUP },
593+ { "prune" , cmd_prune , RUN_SETUP | BLOCK_ON_GVFS_REPO },
589594 { "prune-packed" , cmd_prune_packed , RUN_SETUP },
590595 { "pull" , cmd_pull , RUN_SETUP | NEED_WORK_TREE },
591596 { "push" , cmd_push , RUN_SETUP },
@@ -603,7 +608,7 @@ static struct cmd_struct commands[] = {
603608 { "remote" , cmd_remote , RUN_SETUP },
604609 { "remote-ext" , cmd_remote_ext , NO_PARSEOPT },
605610 { "remote-fd" , cmd_remote_fd , NO_PARSEOPT },
606- { "repack" , cmd_repack , RUN_SETUP },
611+ { "repack" , cmd_repack , RUN_SETUP | BLOCK_ON_GVFS_REPO },
607612 { "replace" , cmd_replace , RUN_SETUP },
608613 { "rerere" , cmd_rerere , RUN_SETUP },
609614 { "reset" , cmd_reset , RUN_SETUP },
@@ -627,7 +632,7 @@ static struct cmd_struct commands[] = {
627632 { "stash" , cmd_stash },
628633 { "status" , cmd_status , RUN_SETUP | NEED_WORK_TREE },
629634 { "stripspace" , cmd_stripspace },
630- { "submodule--helper" , cmd_submodule__helper , RUN_SETUP | SUPPORT_SUPER_PREFIX | NO_PARSEOPT },
635+ { "submodule--helper" , cmd_submodule__helper , RUN_SETUP | SUPPORT_SUPER_PREFIX | NO_PARSEOPT | BLOCK_ON_GVFS_REPO },
631636 { "symbolic-ref" , cmd_symbolic_ref , RUN_SETUP },
632637 { "tag" , cmd_tag , RUN_SETUP | DELAY_PAGER_CONFIG },
633638 { "unpack-file" , cmd_unpack_file , RUN_SETUP | NO_PARSEOPT },
@@ -644,7 +649,7 @@ static struct cmd_struct commands[] = {
644649 { "verify-tag" , cmd_verify_tag , RUN_SETUP },
645650 { "version" , cmd_version },
646651 { "whatchanged" , cmd_whatchanged , RUN_SETUP },
647- { "worktree" , cmd_worktree , RUN_SETUP | NO_PARSEOPT },
652+ { "worktree" , cmd_worktree , RUN_SETUP | NO_PARSEOPT | BLOCK_ON_GVFS_REPO },
648653 { "write-tree" , cmd_write_tree , RUN_SETUP },
649654};
650655
0 commit comments