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 ;
@@ -487,6 +489,9 @@ static int run_builtin(struct cmd_struct *p, int argc, const char **argv)
487
489
if (!help && p -> option & NEED_WORK_TREE )
488
490
setup_work_tree ();
489
491
492
+ if (!help && p -> option & BLOCK_ON_GVFS_REPO && gvfs_config_is_set (GVFS_BLOCK_COMMANDS ))
493
+ die ("'git %s' is not supported on a GVFS repo" , p -> cmd );
494
+
490
495
if (run_pre_command_hook (argv ))
491
496
die ("pre-command hook aborted command" );
492
497
@@ -561,9 +566,9 @@ static struct cmd_struct commands[] = {
561
566
{ "fmt-merge-msg" , cmd_fmt_merge_msg , RUN_SETUP },
562
567
{ "for-each-ref" , cmd_for_each_ref , RUN_SETUP },
563
568
{ "format-patch" , cmd_format_patch , RUN_SETUP },
564
- { "fsck" , cmd_fsck , RUN_SETUP },
569
+ { "fsck" , cmd_fsck , RUN_SETUP | BLOCK_ON_GVFS_REPO },
565
570
{ "fsck-objects" , cmd_fsck , RUN_SETUP },
566
- { "gc" , cmd_gc , RUN_SETUP },
571
+ { "gc" , cmd_gc , RUN_SETUP | BLOCK_ON_GVFS_REPO },
567
572
{ "get-tar-commit-id" , cmd_get_tar_commit_id , NO_PARSEOPT },
568
573
{ "grep" , cmd_grep , RUN_SETUP_GENTLY },
569
574
{ "hash-object" , cmd_hash_object },
@@ -599,7 +604,7 @@ static struct cmd_struct commands[] = {
599
604
{ "pack-refs" , cmd_pack_refs , RUN_SETUP },
600
605
{ "patch-id" , cmd_patch_id , RUN_SETUP_GENTLY | NO_PARSEOPT },
601
606
{ "pickaxe" , cmd_blame , RUN_SETUP },
602
- { "prune" , cmd_prune , RUN_SETUP },
607
+ { "prune" , cmd_prune , RUN_SETUP | BLOCK_ON_GVFS_REPO },
603
608
{ "prune-packed" , cmd_prune_packed , RUN_SETUP },
604
609
{ "pull" , cmd_pull , RUN_SETUP | NEED_WORK_TREE },
605
610
{ "push" , cmd_push , RUN_SETUP },
@@ -617,7 +622,7 @@ static struct cmd_struct commands[] = {
617
622
{ "remote" , cmd_remote , RUN_SETUP },
618
623
{ "remote-ext" , cmd_remote_ext , NO_PARSEOPT },
619
624
{ "remote-fd" , cmd_remote_fd , NO_PARSEOPT },
620
- { "repack" , cmd_repack , RUN_SETUP },
625
+ { "repack" , cmd_repack , RUN_SETUP | BLOCK_ON_GVFS_REPO },
621
626
{ "replace" , cmd_replace , RUN_SETUP },
622
627
{ "rerere" , cmd_rerere , RUN_SETUP },
623
628
{ "reset" , cmd_reset , RUN_SETUP },
@@ -641,7 +646,7 @@ static struct cmd_struct commands[] = {
641
646
{ "stash" , cmd_stash },
642
647
{ "status" , cmd_status , RUN_SETUP | NEED_WORK_TREE },
643
648
{ "stripspace" , cmd_stripspace },
644
- { "submodule--helper" , cmd_submodule__helper , RUN_SETUP | SUPPORT_SUPER_PREFIX | NO_PARSEOPT },
649
+ { "submodule--helper" , cmd_submodule__helper , RUN_SETUP | SUPPORT_SUPER_PREFIX | NO_PARSEOPT | BLOCK_ON_GVFS_REPO },
645
650
{ "symbolic-ref" , cmd_symbolic_ref , RUN_SETUP },
646
651
{ "tag" , cmd_tag , RUN_SETUP | DELAY_PAGER_CONFIG },
647
652
{ "unpack-file" , cmd_unpack_file , RUN_SETUP | NO_PARSEOPT },
@@ -658,7 +663,7 @@ static struct cmd_struct commands[] = {
658
663
{ "verify-tag" , cmd_verify_tag , RUN_SETUP },
659
664
{ "version" , cmd_version },
660
665
{ "whatchanged" , cmd_whatchanged , RUN_SETUP },
661
- { "worktree" , cmd_worktree , RUN_SETUP | NO_PARSEOPT },
666
+ { "worktree" , cmd_worktree , RUN_SETUP | NO_PARSEOPT | BLOCK_ON_GVFS_REPO },
662
667
{ "write-tree" , cmd_write_tree , RUN_SETUP },
663
668
};
664
669
0 commit comments