Skip to content

Commit 191035c

Browse files
mjcheethamdscho
authored andcommitted
git.c: add VFS enabled cmd blocking
Add the ability to block built-in commands based on if the `core.gvfs` setting has the `GVFS_USE_VIRTUAL_FILESYSTEM` bit set. This allows us to selectively block commands that use the GVFS protocol, but don't use VFS for Git (for example repos cloned via `scalar clone` against Azure DevOps). Signed-off-by: Matthew John Cheetham <[email protected]>
1 parent 65ef2d6 commit 191035c

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

git.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
#define DELAY_PAGER_CONFIG (1<<4)
3333
#define NO_PARSEOPT (1<<5) /* parse-options is not used */
3434
#define BLOCK_ON_GVFS_REPO (1<<6) /* command not allowed in GVFS repos */
35+
#define BLOCK_ON_VFS_ENABLED (1<<7) /* command not allowed when virtual file system is used */
3536

3637
struct cmd_struct {
3738
const char *cmd;
@@ -542,6 +543,9 @@ static int run_builtin(struct cmd_struct *p, int argc, const char **argv, struct
542543
if (!help && p->option & BLOCK_ON_GVFS_REPO && gvfs_config_is_set(GVFS_BLOCK_COMMANDS))
543544
die("'git %s' is not supported on a GVFS repo", p->cmd);
544545

546+
if (!help && p->option & BLOCK_ON_VFS_ENABLED && gvfs_config_is_set(GVFS_USE_VIRTUAL_FILESYSTEM))
547+
die("'git %s' is not supported when using the virtual file system", p->cmd);
548+
545549
if (run_pre_command_hook(the_repository, argv))
546550
die("pre-command hook aborted command");
547551

0 commit comments

Comments
 (0)