Skip to content

Commit c3cd018

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 <mjcheetham@outlook.com>
1 parent 0777d10 commit c3cd018

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

‎git.c‎

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

3738
struct cmd_struct {
3839
const char *cmd;
@@ -568,6 +569,9 @@ static int run_builtin(struct cmd_struct *p, int argc, const char **argv, struct
568569
if (!help && p->option & BLOCK_ON_GVFS_REPO && gvfs_config_is_set(repo, GVFS_BLOCK_COMMANDS))
569570
die("'git %s' is not supported on a GVFS repo", p->cmd);
570571

572+
if (!help && p->option & BLOCK_ON_VFS_ENABLED && gvfs_config_is_set(repo, GVFS_USE_VIRTUAL_FILESYSTEM))
573+
die("'git %s' is not supported when using the virtual file system", p->cmd);
574+
571575
if (run_pre_command_hook(the_repository, argv))
572576
die("pre-command hook aborted command");
573577

0 commit comments

Comments
 (0)