5
5
#include "run-command.h"
6
6
#include "alias.h"
7
7
#include "dir.h"
8
+ #include "gvfs.h"
8
9
9
10
#define RUN_SETUP (1<<0)
10
11
#define RUN_SETUP_GENTLY (1<<1)
17
18
#define SUPPORT_SUPER_PREFIX (1<<4)
18
19
#define DELAY_PAGER_CONFIG (1<<5)
19
20
#define NO_PARSEOPT (1<<6) /* parse-options is not used */
21
+ #define BLOCK_ON_GVFS_REPO (1<<7) /* command not allowed in GVFS repos */
20
22
21
23
struct cmd_struct {
22
24
const char * cmd ;
@@ -495,6 +497,9 @@ static int run_builtin(struct cmd_struct *p, int argc, const char **argv)
495
497
if (!help && p -> option & NEED_WORK_TREE )
496
498
setup_work_tree ();
497
499
500
+ if (!help && p -> option & BLOCK_ON_GVFS_REPO && gvfs_config_is_set (GVFS_BLOCK_COMMANDS ))
501
+ die ("'git %s' is not supported on a GVFS repo" , p -> cmd );
502
+
498
503
if (run_pre_command_hook (argv ))
499
504
die ("pre-command hook aborted command" );
500
505
@@ -569,7 +574,7 @@ static struct cmd_struct commands[] = {
569
574
{ "fmt-merge-msg" , cmd_fmt_merge_msg , RUN_SETUP },
570
575
{ "for-each-ref" , cmd_for_each_ref , RUN_SETUP },
571
576
{ "format-patch" , cmd_format_patch , RUN_SETUP },
572
- { "fsck" , cmd_fsck , RUN_SETUP },
577
+ { "fsck" , cmd_fsck , RUN_SETUP | BLOCK_ON_GVFS_REPO },
573
578
{ "fsck-objects" , cmd_fsck , RUN_SETUP },
574
579
{ "gc" , cmd_gc , RUN_SETUP },
575
580
{ "get-tar-commit-id" , cmd_get_tar_commit_id , NO_PARSEOPT },
@@ -607,7 +612,7 @@ static struct cmd_struct commands[] = {
607
612
{ "pack-refs" , cmd_pack_refs , RUN_SETUP },
608
613
{ "patch-id" , cmd_patch_id , RUN_SETUP_GENTLY | NO_PARSEOPT },
609
614
{ "pickaxe" , cmd_blame , RUN_SETUP },
610
- { "prune" , cmd_prune , RUN_SETUP },
615
+ { "prune" , cmd_prune , RUN_SETUP | BLOCK_ON_GVFS_REPO },
611
616
{ "prune-packed" , cmd_prune_packed , RUN_SETUP },
612
617
{ "pull" , cmd_pull , RUN_SETUP | NEED_WORK_TREE },
613
618
{ "push" , cmd_push , RUN_SETUP },
@@ -625,7 +630,7 @@ static struct cmd_struct commands[] = {
625
630
{ "remote" , cmd_remote , RUN_SETUP },
626
631
{ "remote-ext" , cmd_remote_ext , NO_PARSEOPT },
627
632
{ "remote-fd" , cmd_remote_fd , NO_PARSEOPT },
628
- { "repack" , cmd_repack , RUN_SETUP },
633
+ { "repack" , cmd_repack , RUN_SETUP | BLOCK_ON_GVFS_REPO },
629
634
{ "replace" , cmd_replace , RUN_SETUP },
630
635
{ "rerere" , cmd_rerere , RUN_SETUP },
631
636
{ "reset" , cmd_reset , RUN_SETUP },
@@ -648,7 +653,7 @@ static struct cmd_struct commands[] = {
648
653
{ "stash" , cmd_stash },
649
654
{ "status" , cmd_status , RUN_SETUP | NEED_WORK_TREE },
650
655
{ "stripspace" , cmd_stripspace },
651
- { "submodule--helper" , cmd_submodule__helper , RUN_SETUP | SUPPORT_SUPER_PREFIX | NO_PARSEOPT },
656
+ { "submodule--helper" , cmd_submodule__helper , RUN_SETUP | SUPPORT_SUPER_PREFIX | NO_PARSEOPT | BLOCK_ON_GVFS_REPO },
652
657
{ "symbolic-ref" , cmd_symbolic_ref , RUN_SETUP },
653
658
{ "tag" , cmd_tag , RUN_SETUP | DELAY_PAGER_CONFIG },
654
659
{ "unpack-file" , cmd_unpack_file , RUN_SETUP | NO_PARSEOPT },
@@ -665,7 +670,7 @@ static struct cmd_struct commands[] = {
665
670
{ "verify-tag" , cmd_verify_tag , RUN_SETUP },
666
671
{ "version" , cmd_version },
667
672
{ "whatchanged" , cmd_whatchanged , RUN_SETUP },
668
- { "worktree" , cmd_worktree , RUN_SETUP | NO_PARSEOPT },
673
+ { "worktree" , cmd_worktree , RUN_SETUP | NO_PARSEOPT | BLOCK_ON_GVFS_REPO },
669
674
{ "write-tree" , cmd_write_tree , RUN_SETUP },
670
675
};
671
676
0 commit comments