1
1
#define USE_THE_REPOSITORY_VARIABLE
2
2
3
3
#include "builtin.h"
4
+ #include "gvfs.h"
4
5
#include "config.h"
5
6
#include "environment.h"
6
7
#include "exec-cmd.h"
30
31
#define NEED_WORK_TREE (1<<3)
31
32
#define DELAY_PAGER_CONFIG (1<<4)
32
33
#define NO_PARSEOPT (1<<5) /* parse-options is not used */
34
+ #define BLOCK_ON_GVFS_REPO (1<<6) /* command not allowed in GVFS repos */
33
35
34
36
struct cmd_struct {
35
37
const char * cmd ;
@@ -537,6 +539,9 @@ static int run_builtin(struct cmd_struct *p, int argc, const char **argv, struct
537
539
if (!help && p -> option & NEED_WORK_TREE )
538
540
setup_work_tree ();
539
541
542
+ if (!help && p -> option & BLOCK_ON_GVFS_REPO && gvfs_config_is_set (repo , GVFS_BLOCK_COMMANDS ))
543
+ die ("'git %s' is not supported on a GVFS repo" , p -> cmd );
544
+
540
545
if (run_pre_command_hook (the_repository , argv ))
541
546
die ("pre-command hook aborted command" );
542
547
@@ -621,7 +626,7 @@ static struct cmd_struct commands[] = {
621
626
{ "for-each-ref" , cmd_for_each_ref , RUN_SETUP },
622
627
{ "for-each-repo" , cmd_for_each_repo , RUN_SETUP_GENTLY },
623
628
{ "format-patch" , cmd_format_patch , RUN_SETUP },
624
- { "fsck" , cmd_fsck , RUN_SETUP },
629
+ { "fsck" , cmd_fsck , RUN_SETUP | BLOCK_ON_GVFS_REPO },
625
630
{ "fsck-objects" , cmd_fsck , RUN_SETUP },
626
631
{ "fsmonitor--daemon" , cmd_fsmonitor__daemon , RUN_SETUP },
627
632
{ "gc" , cmd_gc , RUN_SETUP },
@@ -664,7 +669,7 @@ static struct cmd_struct commands[] = {
664
669
{ "pack-refs" , cmd_pack_refs , RUN_SETUP },
665
670
{ "patch-id" , cmd_patch_id , RUN_SETUP_GENTLY | NO_PARSEOPT },
666
671
{ "pickaxe" , cmd_blame , RUN_SETUP },
667
- { "prune" , cmd_prune , RUN_SETUP },
672
+ { "prune" , cmd_prune , RUN_SETUP | BLOCK_ON_GVFS_REPO },
668
673
{ "prune-packed" , cmd_prune_packed , RUN_SETUP },
669
674
{ "pull" , cmd_pull , RUN_SETUP | NEED_WORK_TREE },
670
675
{ "push" , cmd_push , RUN_SETUP },
@@ -677,7 +682,7 @@ static struct cmd_struct commands[] = {
677
682
{ "remote" , cmd_remote , RUN_SETUP },
678
683
{ "remote-ext" , cmd_remote_ext , NO_PARSEOPT },
679
684
{ "remote-fd" , cmd_remote_fd , NO_PARSEOPT },
680
- { "repack" , cmd_repack , RUN_SETUP },
685
+ { "repack" , cmd_repack , RUN_SETUP | BLOCK_ON_GVFS_REPO },
681
686
{ "replace" , cmd_replace , RUN_SETUP },
682
687
{ "replay" , cmd_replay , RUN_SETUP },
683
688
{ "rerere" , cmd_rerere , RUN_SETUP },
@@ -698,7 +703,7 @@ static struct cmd_struct commands[] = {
698
703
{ "stash" , cmd_stash , RUN_SETUP | NEED_WORK_TREE },
699
704
{ "status" , cmd_status , RUN_SETUP | NEED_WORK_TREE },
700
705
{ "stripspace" , cmd_stripspace },
701
- { "submodule--helper" , cmd_submodule__helper , RUN_SETUP },
706
+ { "submodule--helper" , cmd_submodule__helper , RUN_SETUP | BLOCK_ON_GVFS_REPO },
702
707
{ "survey" , cmd_survey , RUN_SETUP },
703
708
{ "switch" , cmd_switch , RUN_SETUP | NEED_WORK_TREE },
704
709
{ "symbolic-ref" , cmd_symbolic_ref , RUN_SETUP },
@@ -719,7 +724,7 @@ static struct cmd_struct commands[] = {
719
724
#ifndef WITH_BREAKING_CHANGES
720
725
{ "whatchanged" , cmd_whatchanged , RUN_SETUP },
721
726
#endif
722
- { "worktree" , cmd_worktree , RUN_SETUP },
727
+ { "worktree" , cmd_worktree , RUN_SETUP | BLOCK_ON_GVFS_REPO },
723
728
{ "write-tree" , cmd_write_tree , RUN_SETUP },
724
729
};
725
730
0 commit comments