Skip to content

Commit ad0834c

Browse files
dschoderrickstolee
authored andcommitted
vfs: disable git update-git-for-windows
If a user runs git update-git-for-windows, then they will upgrade to a version that does not support microsoft/vfsforgit or microsoft/scalar. Therefore, let's prevent this. This addresses #241
1 parent 39f700f commit ad0834c

File tree

4 files changed

+26
-0
lines changed

4 files changed

+26
-0
lines changed

builtin.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,7 @@ int cmd_tag(int argc, const char **argv, const char *prefix);
220220
int cmd_tar_tree(int argc, const char **argv, const char *prefix);
221221
int cmd_unpack_file(int argc, const char **argv, const char *prefix);
222222
int cmd_unpack_objects(int argc, const char **argv, const char *prefix);
223+
int cmd_update(int argc, const char **argv, const char *prefix);
223224
int cmd_update_index(int argc, const char **argv, const char *prefix);
224225
int cmd_update_ref(int argc, const char **argv, const char *prefix);
225226
int cmd_update_server_info(int argc, const char **argv, const char *prefix);

git.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -658,6 +658,8 @@ static struct cmd_struct commands[] = {
658658
{ "tag", cmd_tag, RUN_SETUP | DELAY_PAGER_CONFIG },
659659
{ "unpack-file", cmd_unpack_file, RUN_SETUP | NO_PARSEOPT },
660660
{ "unpack-objects", cmd_unpack_objects, RUN_SETUP | NO_PARSEOPT },
661+
{ "update", cmd_update },
662+
{ "update-git-for-windows", cmd_update },
661663
{ "update-index", cmd_update_index, RUN_SETUP },
662664
{ "update-ref", cmd_update_ref, RUN_SETUP },
663665
{ "update-server-info", cmd_update_server_info, RUN_SETUP },

help.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -720,3 +720,19 @@ NORETURN void help_unknown_ref(const char *ref, const char *cmd,
720720
string_list_clear(&suggested_refs, 0);
721721
exit(1);
722722
}
723+
724+
int cmd_update(int argc, const char **argv, const char *prefix)
725+
{
726+
const char * const usage[] = {
727+
N_("git update-git-for-windows [<options>]\n"
728+
"\t(not supported in this build of Git for Windows)"),
729+
NULL
730+
};
731+
struct option options[] = {
732+
OPT_END()
733+
};
734+
735+
argc = parse_options(argc, argv, prefix, options, usage, 0);
736+
737+
die(_("git %s is not supported in VFSforGit"), argv[0]);
738+
}

t/t0402-block-command-on-gvfs.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,11 @@ test_expect_success 'test gc --auto succeeds when disabled via config' '
3636
git gc --auto
3737
'
3838

39+
test_expect_success 'update-git-for-windows disabled' '
40+
test_must_fail git update 2>out &&
41+
test_i18ngrep VFS out &&
42+
test_must_fail git update-git-for-windows 2>out &&
43+
test_i18ngrep VFS out
44+
'
45+
3946
test_done

0 commit comments

Comments
 (0)