-
Notifications
You must be signed in to change notification settings - Fork 97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add git update-microsoft-git
#329
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
git-update-microsoft-git(1) | ||
=========================== | ||
|
||
NAME | ||
---- | ||
git-update-microsoft-git - Update the installed version of Git | ||
|
||
|
||
SYNOPSIS | ||
-------- | ||
[verse] | ||
'git update-microsoft-git' | ||
|
||
DESCRIPTION | ||
----------- | ||
This version of Git is based on the Microsoft fork of Git, which | ||
has custom capabilities focused on supporting monorepos. This | ||
command checks for the latest release of that fork and installs | ||
it on your machine. | ||
|
||
|
||
GIT | ||
--- | ||
Part of the linkgit:git[1] suite |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
#include "builtin.h" | ||
#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. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does the microsoft/git version of build-extra point Maybe link to that. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here is the script but the real change is inside our Azure Pipeline build (yikes). See #321 for details. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. WOW! That's dense. I'm not sure I'm adding value here. Maybe add enough bread crumbs to the comment here so that we can rediscover how this works in the future.... |
||
*/ | ||
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; | ||
} | ||
#elif defined(__APPLE__) | ||
/* | ||
* On macOS, we expect the user to have the microsoft-git | ||
* cask installed via Homebrew. We check using these | ||
* commands: | ||
* | ||
* 1. 'brew update' to get latest versions. | ||
* 2. 'brew upgrade --cask microsoft-git' to get the | ||
* latest version. | ||
*/ | ||
static int platform_specific_upgrade(void) | ||
{ | ||
int res; | ||
struct strvec args = STRVEC_INIT; | ||
|
||
printf("Updating Homebrew with 'brew update'\n"); | ||
|
||
strvec_pushl(&args, "brew", "update", NULL); | ||
res = run_command_v_opt(args.v, 0); | ||
strvec_clear(&args); | ||
|
||
if (res) { | ||
error(_("'brew update' failed; is brew installed?")); | ||
return 1; | ||
} | ||
|
||
printf("Upgrading microsoft-git with 'brew upgrade --cask microsoft-git'\n"); | ||
strvec_pushl(&args, "brew", "upgrade", "--cask", "microsoft-git", NULL); | ||
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"); | ||
|
||
int cmd_update_microsoft_git(int argc, const char **argv, const char *prefix) | ||
{ | ||
if (argc == 2 && !strcmp(argv[1], "-h")) | ||
usage(builtin_update_microsoft_git_usage); | ||
|
||
return platform_specific_upgrade(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we add a short statement about GVFS here? Our enhancements in this fork fall into 2 groups: monorepo stuff we want to eventually upstream, and the GVFS-related stuff which will never make it upstream.
Basically, I'm thinking about a short ack/reminder here about why we have this fork at all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should update the
README
with these details. A user won't see this documentation unless they are looking at the version that is installed with themicrosoft/git
fork.