Skip to content

Commit

Permalink
Merge pull request microsoft#434: Integrate `git update-microsoft-git…
Browse files Browse the repository at this point in the history
…` with `apt-get`

Extend the `git update-microsoft-git` builtin to call `apt-get` in a similar way we do `brew` on macOS.
  • Loading branch information
derrickstolee authored and ldennington committed Jan 12, 2022
2 parents 1034f4d + 1c388bc commit af911b3
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions builtin/update-microsoft-git.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,26 @@ static int platform_specific_upgrade(void)
#else
static int platform_specific_upgrade(void)
{
error(_("update-microsoft-git is not supported on this platform"));
return 1;
int res;
struct strvec args = STRVEC_INIT;

printf("Updating apt-get with 'sudo apt-get update'\n\n");

strvec_pushl(&args, "sudo", "apt-get", "update", NULL);
res = run_command_v_opt(args.v, 0);
strvec_clear(&args);

if (res) {
error(_("'sudo apt-get update' failed; is apt-get installed?"));
return 1;
}

printf("\nUpgrading microsoft-git with 'sudo apt-get upgrade microsoft-git'\n\n");
strvec_pushl(&args, "sudo", "apt-get", "upgrade", "microsoft-git", NULL);
res = run_command_v_opt(args.v, 0);
strvec_clear(&args);

return res;
}
#endif

Expand Down

0 comments on commit af911b3

Please sign in to comment.