From ca0e0bf80b0b3764acdb68264d3add5a1fdafc2b Mon Sep 17 00:00:00 2001 From: Derrick Stolee Date: Thu, 29 Apr 2021 11:02:07 -0400 Subject: [PATCH] update-microsoft-git: Windows implementation On Windows, we have the 'git update-git-for-windows' command. It is poorly named within the microsoft/git fork, because the script has been updated to look at the GitHub releases of microsoft/git, not git-for-windows/git. Still, it handles all the complicated details about downloading, verifying, and running the installer. Signed-off-by: Derrick Stolee --- builtin/update-microsoft-git.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/builtin/update-microsoft-git.c b/builtin/update-microsoft-git.c index 329f6d77c0d1c9..8c4d2bd6a8b14d 100644 --- a/builtin/update-microsoft-git.c +++ b/builtin/update-microsoft-git.c @@ -2,11 +2,31 @@ #include "repository.h" #include "parse-options.h" #include "run-command.h" +#include "strvec.h" +#if defined(GIT_WINDOWS_NATIVE) +/* + * On Windows, run 'git update-git-for-windows' which + * is installed by the installer, based on the script + * in git-for-windows/build-extra. + */ static int platform_specific_upgrade(void) { + int res; + struct strvec args = STRVEC_INIT; + + strvec_push(&args, "git-update-git-for-windows"); + res = run_command_v_opt(args.v, 0); + strvec_clear(&args); + return res; +} +#else +static int platform_specific_upgrade(void) +{ + error(_("update-microsoft-git is not supported on this platform")); return 1; } +#endif static const char builtin_update_microsoft_git_usage[] = N_("git update-microsoft-git");