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"
28
29
#define NEED_WORK_TREE (1<<3)
29
30
#define DELAY_PAGER_CONFIG (1<<4)
30
31
#define NO_PARSEOPT (1<<5) /* parse-options is not used */
32
+ #define BLOCK_ON_GVFS_REPO (1<<6) /* command not allowed in GVFS repos */
31
33
32
34
struct cmd_struct {
33
35
const char * cmd ;
@@ -526,6 +528,9 @@ static int run_builtin(struct cmd_struct *p, int argc, const char **argv)
526
528
if (!help && p -> option & NEED_WORK_TREE )
527
529
setup_work_tree ();
528
530
531
+ if (!help && p -> option & BLOCK_ON_GVFS_REPO && gvfs_config_is_set (GVFS_BLOCK_COMMANDS ))
532
+ die ("'git %s' is not supported on a GVFS repo" , p -> cmd );
533
+
529
534
if (run_pre_command_hook (argv ))
530
535
die ("pre-command hook aborted command" );
531
536
@@ -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
{ "replay" , cmd_replay , RUN_SETUP },
667
672
{ "rerere" , cmd_rerere , RUN_SETUP },
@@ -682,7 +687,7 @@ static struct cmd_struct commands[] = {
682
687
{ "stash" , cmd_stash , RUN_SETUP | NEED_WORK_TREE },
683
688
{ "status" , cmd_status , RUN_SETUP | NEED_WORK_TREE },
684
689
{ "stripspace" , cmd_stripspace },
685
- { "submodule--helper" , cmd_submodule__helper , RUN_SETUP },
690
+ { "submodule--helper" , cmd_submodule__helper , RUN_SETUP | BLOCK_ON_GVFS_REPO },
686
691
{ "survey" , cmd_survey , RUN_SETUP },
687
692
{ "switch" , cmd_switch , RUN_SETUP | NEED_WORK_TREE },
688
693
{ "symbolic-ref" , cmd_symbolic_ref , RUN_SETUP },
@@ -701,7 +706,7 @@ static struct cmd_struct commands[] = {
701
706
{ "verify-tag" , cmd_verify_tag , RUN_SETUP },
702
707
{ "version" , cmd_version },
703
708
{ "whatchanged" , cmd_whatchanged , RUN_SETUP },
704
- { "worktree" , cmd_worktree , RUN_SETUP },
709
+ { "worktree" , cmd_worktree , RUN_SETUP | BLOCK_ON_GVFS_REPO },
705
710
{ "write-tree" , cmd_write_tree , RUN_SETUP },
706
711
};
707
712
0 commit comments