1
1
#include "builtin.h"
2
+ #include "gvfs.h"
2
3
#include "config.h"
3
4
#include "environment.h"
4
5
#include "exec-cmd.h"
27
28
#define NEED_WORK_TREE (1<<3)
28
29
#define DELAY_PAGER_CONFIG (1<<4)
29
30
#define NO_PARSEOPT (1<<5) /* parse-options is not used */
31
+ #define BLOCK_ON_GVFS_REPO (1<<6) /* command not allowed in GVFS repos */
30
32
31
33
struct cmd_struct {
32
34
const char * cmd ;
@@ -524,6 +526,9 @@ static int run_builtin(struct cmd_struct *p, int argc, const char **argv)
524
526
if (!help && p -> option & NEED_WORK_TREE )
525
527
setup_work_tree ();
526
528
529
+ if (!help && p -> option & BLOCK_ON_GVFS_REPO && gvfs_config_is_set (GVFS_BLOCK_COMMANDS ))
530
+ die ("'git %s' is not supported on a GVFS repo" , p -> cmd );
531
+
527
532
if (run_pre_command_hook (argv ))
528
533
die ("pre-command hook aborted command" );
529
534
@@ -608,7 +613,7 @@ static struct cmd_struct commands[] = {
608
613
{ "for-each-ref" , cmd_for_each_ref , RUN_SETUP },
609
614
{ "for-each-repo" , cmd_for_each_repo , RUN_SETUP_GENTLY },
610
615
{ "format-patch" , cmd_format_patch , RUN_SETUP },
611
- { "fsck" , cmd_fsck , RUN_SETUP },
616
+ { "fsck" , cmd_fsck , RUN_SETUP | BLOCK_ON_GVFS_REPO },
612
617
{ "fsck-objects" , cmd_fsck , RUN_SETUP },
613
618
{ "fsmonitor--daemon" , cmd_fsmonitor__daemon , RUN_SETUP },
614
619
{ "gc" , cmd_gc , RUN_SETUP },
@@ -649,7 +654,7 @@ static struct cmd_struct commands[] = {
649
654
{ "pack-refs" , cmd_pack_refs , RUN_SETUP },
650
655
{ "patch-id" , cmd_patch_id , RUN_SETUP_GENTLY | NO_PARSEOPT },
651
656
{ "pickaxe" , cmd_blame , RUN_SETUP },
652
- { "prune" , cmd_prune , RUN_SETUP },
657
+ { "prune" , cmd_prune , RUN_SETUP | BLOCK_ON_GVFS_REPO },
653
658
{ "prune-packed" , cmd_prune_packed , RUN_SETUP },
654
659
{ "pull" , cmd_pull , RUN_SETUP | NEED_WORK_TREE },
655
660
{ "push" , cmd_push , RUN_SETUP },
@@ -661,7 +666,7 @@ static struct cmd_struct commands[] = {
661
666
{ "remote" , cmd_remote , RUN_SETUP },
662
667
{ "remote-ext" , cmd_remote_ext , NO_PARSEOPT },
663
668
{ "remote-fd" , cmd_remote_fd , NO_PARSEOPT },
664
- { "repack" , cmd_repack , RUN_SETUP },
669
+ { "repack" , cmd_repack , RUN_SETUP | BLOCK_ON_GVFS_REPO },
665
670
{ "replace" , cmd_replace , RUN_SETUP },
666
671
{ "rerere" , cmd_rerere , RUN_SETUP },
667
672
{ "reset" , cmd_reset , RUN_SETUP },
@@ -681,7 +686,7 @@ static struct cmd_struct commands[] = {
681
686
{ "stash" , cmd_stash , RUN_SETUP | NEED_WORK_TREE },
682
687
{ "status" , cmd_status , RUN_SETUP | NEED_WORK_TREE },
683
688
{ "stripspace" , cmd_stripspace },
684
- { "submodule--helper" , cmd_submodule__helper , RUN_SETUP },
689
+ { "submodule--helper" , cmd_submodule__helper , RUN_SETUP | BLOCK_ON_GVFS_REPO },
685
690
{ "switch" , cmd_switch , RUN_SETUP | NEED_WORK_TREE },
686
691
{ "symbolic-ref" , cmd_symbolic_ref , RUN_SETUP },
687
692
{ "tag" , cmd_tag , RUN_SETUP | DELAY_PAGER_CONFIG },
@@ -699,7 +704,7 @@ static struct cmd_struct commands[] = {
699
704
{ "verify-tag" , cmd_verify_tag , RUN_SETUP },
700
705
{ "version" , cmd_version },
701
706
{ "whatchanged" , cmd_whatchanged , RUN_SETUP },
702
- { "worktree" , cmd_worktree , RUN_SETUP },
707
+ { "worktree" , cmd_worktree , RUN_SETUP | BLOCK_ON_GVFS_REPO },
703
708
{ "write-tree" , cmd_write_tree , RUN_SETUP },
704
709
};
705
710
0 commit comments