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