Skip to content

Commit 2b75c30

Browse files
committed
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 <[email protected]>
1 parent df632eb commit 2b75c30

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

builtin/update-microsoft-git.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,31 @@
22
#include "repository.h"
33
#include "parse-options.h"
44
#include "run-command.h"
5+
#include "strvec.h"
56

7+
#if defined(GIT_WINDOWS_NATIVE)
8+
/*
9+
* On Windows, run 'git update-git-for-windows' which
10+
* is installed by the installer, based on the script
11+
* in git-for-windows/build-extra.
12+
*/
613
static int platform_specific_upgrade(void)
714
{
15+
int res;
16+
struct strvec args = STRVEC_INIT;
17+
18+
strvec_push(&args, "git-update-git-for-windows");
19+
res = run_command_v_opt(args.v, 0);
20+
strvec_clear(&args);
21+
return res;
22+
}
23+
#else
24+
static int platform_specific_upgrade(void)
25+
{
26+
error(_("update-microsoft-git is not supported on this platform"));
827
return 1;
928
}
29+
#endif
1030

1131
static const char builtin_update_microsoft_git_usage[] =
1232
N_("git update-microsoft-git");

0 commit comments

Comments
 (0)