11#define USE_THE_REPOSITORY_VARIABLE
22
33#include "builtin.h"
4+ #include "gvfs.h"
45#include "config.h"
56#include "environment.h"
67#include "exec-cmd.h"
3132#define DELAY_PAGER_CONFIG (1<<4)
3233#define NO_PARSEOPT (1<<5) /* parse-options is not used */
3334#define DEPRECATED (1<<6)
35+ #define BLOCK_ON_GVFS_REPO (1<<7) /* command not allowed in GVFS repos */
3436
3537struct cmd_struct {
3638 const char * cmd ;
@@ -563,6 +565,9 @@ static int run_builtin(struct cmd_struct *p, int argc, const char **argv, struct
563565 if (!help && p -> option & NEED_WORK_TREE )
564566 setup_work_tree ();
565567
568+ if (!help && p -> option & BLOCK_ON_GVFS_REPO && gvfs_config_is_set (repo , GVFS_BLOCK_COMMANDS ))
569+ die ("'git %s' is not supported on a GVFS repo" , p -> cmd );
570+
566571 if (run_pre_command_hook (the_repository , argv ))
567572 die ("pre-command hook aborted command" );
568573
@@ -647,7 +652,7 @@ static struct cmd_struct commands[] = {
647652 { "for-each-ref" , cmd_for_each_ref , RUN_SETUP },
648653 { "for-each-repo" , cmd_for_each_repo , RUN_SETUP_GENTLY },
649654 { "format-patch" , cmd_format_patch , RUN_SETUP },
650- { "fsck" , cmd_fsck , RUN_SETUP },
655+ { "fsck" , cmd_fsck , RUN_SETUP | BLOCK_ON_GVFS_REPO },
651656 { "fsck-objects" , cmd_fsck , RUN_SETUP },
652657 { "fsmonitor--daemon" , cmd_fsmonitor__daemon , RUN_SETUP },
653658 { "gc" , cmd_gc , RUN_SETUP },
@@ -691,7 +696,7 @@ static struct cmd_struct commands[] = {
691696 { "pack-refs" , cmd_pack_refs , RUN_SETUP },
692697 { "patch-id" , cmd_patch_id , RUN_SETUP_GENTLY | NO_PARSEOPT },
693698 { "pickaxe" , cmd_blame , RUN_SETUP },
694- { "prune" , cmd_prune , RUN_SETUP },
699+ { "prune" , cmd_prune , RUN_SETUP | BLOCK_ON_GVFS_REPO },
695700 { "prune-packed" , cmd_prune_packed , RUN_SETUP },
696701 { "pull" , cmd_pull , RUN_SETUP | NEED_WORK_TREE },
697702 { "push" , cmd_push , RUN_SETUP },
@@ -704,7 +709,7 @@ static struct cmd_struct commands[] = {
704709 { "remote" , cmd_remote , RUN_SETUP },
705710 { "remote-ext" , cmd_remote_ext , NO_PARSEOPT },
706711 { "remote-fd" , cmd_remote_fd , NO_PARSEOPT },
707- { "repack" , cmd_repack , RUN_SETUP },
712+ { "repack" , cmd_repack , RUN_SETUP | BLOCK_ON_GVFS_REPO },
708713 { "replace" , cmd_replace , RUN_SETUP },
709714 { "replay" , cmd_replay , RUN_SETUP },
710715 { "repo" , cmd_repo , RUN_SETUP },
@@ -726,7 +731,7 @@ static struct cmd_struct commands[] = {
726731 { "stash" , cmd_stash , RUN_SETUP | NEED_WORK_TREE },
727732 { "status" , cmd_status , RUN_SETUP | NEED_WORK_TREE },
728733 { "stripspace" , cmd_stripspace },
729- { "submodule--helper" , cmd_submodule__helper , RUN_SETUP },
734+ { "submodule--helper" , cmd_submodule__helper , RUN_SETUP | BLOCK_ON_GVFS_REPO },
730735 { "survey" , cmd_survey , RUN_SETUP },
731736 { "switch" , cmd_switch , RUN_SETUP | NEED_WORK_TREE },
732737 { "symbolic-ref" , cmd_symbolic_ref , RUN_SETUP },
@@ -747,7 +752,7 @@ static struct cmd_struct commands[] = {
747752#ifndef WITH_BREAKING_CHANGES
748753 { "whatchanged" , cmd_whatchanged , RUN_SETUP | DEPRECATED },
749754#endif
750- { "worktree" , cmd_worktree , RUN_SETUP },
755+ { "worktree" , cmd_worktree , RUN_SETUP | BLOCK_ON_GVFS_REPO },
751756 { "write-tree" , cmd_write_tree , RUN_SETUP },
752757};
753758
0 commit comments