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"
3031#define NEED_WORK_TREE (1<<3)
3132#define DELAY_PAGER_CONFIG (1<<4)
3233#define NO_PARSEOPT (1<<5) /* parse-options is not used */
34+ #define BLOCK_ON_GVFS_REPO (1<<6) /* command not allowed in GVFS repos */
3335
3436struct cmd_struct {
3537 const char * cmd ;
@@ -537,6 +539,9 @@ static int run_builtin(struct cmd_struct *p, int argc, const char **argv, struct
537539 if (!help && p -> option & NEED_WORK_TREE )
538540 setup_work_tree ();
539541
542+ if (!help && p -> option & BLOCK_ON_GVFS_REPO && gvfs_config_is_set (GVFS_BLOCK_COMMANDS ))
543+ die ("'git %s' is not supported on a GVFS repo" , p -> cmd );
544+
540545 if (run_pre_command_hook (the_repository , argv ))
541546 die ("pre-command hook aborted command" );
542547
@@ -620,7 +625,7 @@ static struct cmd_struct commands[] = {
620625 { "for-each-ref" , cmd_for_each_ref , RUN_SETUP },
621626 { "for-each-repo" , cmd_for_each_repo , RUN_SETUP_GENTLY },
622627 { "format-patch" , cmd_format_patch , RUN_SETUP },
623- { "fsck" , cmd_fsck , RUN_SETUP },
628+ { "fsck" , cmd_fsck , RUN_SETUP | BLOCK_ON_GVFS_REPO },
624629 { "fsck-objects" , cmd_fsck , RUN_SETUP },
625630 { "fsmonitor--daemon" , cmd_fsmonitor__daemon , RUN_SETUP },
626631 { "gc" , cmd_gc , RUN_SETUP },
@@ -661,7 +666,7 @@ static struct cmd_struct commands[] = {
661666 { "pack-refs" , cmd_pack_refs , RUN_SETUP },
662667 { "patch-id" , cmd_patch_id , RUN_SETUP_GENTLY | NO_PARSEOPT },
663668 { "pickaxe" , cmd_blame , RUN_SETUP },
664- { "prune" , cmd_prune , RUN_SETUP },
669+ { "prune" , cmd_prune , RUN_SETUP | BLOCK_ON_GVFS_REPO },
665670 { "prune-packed" , cmd_prune_packed , RUN_SETUP },
666671 { "pull" , cmd_pull , RUN_SETUP | NEED_WORK_TREE },
667672 { "push" , cmd_push , RUN_SETUP },
@@ -674,7 +679,7 @@ static struct cmd_struct commands[] = {
674679 { "remote" , cmd_remote , RUN_SETUP },
675680 { "remote-ext" , cmd_remote_ext , NO_PARSEOPT },
676681 { "remote-fd" , cmd_remote_fd , NO_PARSEOPT },
677- { "repack" , cmd_repack , RUN_SETUP },
682+ { "repack" , cmd_repack , RUN_SETUP | BLOCK_ON_GVFS_REPO },
678683 { "replace" , cmd_replace , RUN_SETUP },
679684 { "replay" , cmd_replay , RUN_SETUP },
680685 { "rerere" , cmd_rerere , RUN_SETUP },
@@ -695,7 +700,7 @@ static struct cmd_struct commands[] = {
695700 { "stash" , cmd_stash , RUN_SETUP | NEED_WORK_TREE },
696701 { "status" , cmd_status , RUN_SETUP | NEED_WORK_TREE },
697702 { "stripspace" , cmd_stripspace },
698- { "submodule--helper" , cmd_submodule__helper , RUN_SETUP },
703+ { "submodule--helper" , cmd_submodule__helper , RUN_SETUP | BLOCK_ON_GVFS_REPO },
699704 { "survey" , cmd_survey , RUN_SETUP },
700705 { "switch" , cmd_switch , RUN_SETUP | NEED_WORK_TREE },
701706 { "symbolic-ref" , cmd_symbolic_ref , RUN_SETUP },
@@ -714,7 +719,7 @@ static struct cmd_struct commands[] = {
714719 { "verify-tag" , cmd_verify_tag , RUN_SETUP },
715720 { "version" , cmd_version },
716721 { "whatchanged" , cmd_whatchanged , RUN_SETUP },
717- { "worktree" , cmd_worktree , RUN_SETUP },
722+ { "worktree" , cmd_worktree , RUN_SETUP | BLOCK_ON_GVFS_REPO },
718723 { "write-tree" , cmd_write_tree , RUN_SETUP },
719724};
720725
0 commit comments