Skip to content
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

git update-git-for-windows: download ARM64 Git for Windows if applicable #340

Merged
merged 1 commit into from
May 18, 2021

Conversation

dennisameling
Copy link
Contributor

@dennisameling dennisameling commented May 8, 2021

Builds further on #338
Needed for git-for-windows/git#3107

If the /arm64/bin folder is present, we assume that the user has the ARM64 version of Git for Windows installed. When a new version is available, we'll then automatically download the ARM64 version. This is similar to the logic in git-wrapper.c in mingw-w64-git.

Sample release with a fake ARM64 installer (renamed 64-bit installer, just to show that the installer indeed downloads the correct file): https://github.com/dennisameling/git/releases/tag/2.31.2.windows.1

Tested as follows:

  1. Ensure /arm64/bin folder is present
  2. Point the update check script to my fake 2.31.2 release: https://github.com/dennisameling/git/releases/tag/2.31.2.windows.1
  3. Run cmd\git.exe update-git-for-windows --gui from Git Bash
  4. Get the "Update available" notification - it correctly downloaded the ARM64 installer

if [ -d "/arm64/bin" ]
then
version_string="Git for Windows $version (ARM64)"
filename_for_download="ARM64\.exe"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assumed that you want to call the ARM64 binaries something like Git-2.31.2-ARM64.exe - happy to change if you think there might be a better name though!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, I concur with you: Git-2.31.2-ARM64.exe sounds good.

Copy link
Member

@dscho dscho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for all your work on the ARM64 version of Git for Windows!!!

I'd like to ask for just minor changes, and for a rebase on top of my (updated) PR.

@@ -211,7 +211,16 @@ update_git_for_windows () {
test -n "$quiet" && test "x$recently_seen" = "x$latest" && return

version=$(git --version | sed "s/git version //")
echo "Git for Windows $version (${bit}bit)" >&2
version_string="Git for Windows $version (${bit}bit)"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably be replaced already, too. How about

if test -d /arm64/bin
then
    arch_bit=ARM64
else
    arch_bit=${bit}-bit
fi

echo "Git for Windows $version ($arch_bit)" >&2

[...]
        grep "$arch_bit\.exe" |
[...]

version_string="Git for Windows $version (${bit}bit)"
filename_for_download="$bit\-bit\.exe"

if [ -d "/arm64/bin" ]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically, the Git wrapper does more: it first verifies that we are running on ARM64. Therefore, we could implement the --is-running-on-ARM64 option in /cmd/git.exe and use that. But that sounds like quite a bit of effort for almost no value in return, so I'm fine with the directory check.

To align with Git's coding style, I would like to use test instead of [, though.

if [ -d "/arm64/bin" ]
then
version_string="Git for Windows $version (ARM64)"
filename_for_download="ARM64\.exe"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, I concur with you: Git-2.31.2-ARM64.exe sounds good.

If the /arm64/bin folder is present, we assume that the user has the
ARM64 version of Git for Windows installed. When a new version is
available, we'll then automatically download the ARM64 version. This is
similar to the logic in git-wrapper.c in mingw-w64-git (technically, the
Git wrapper _also_ tests whether it is running an ARM64 executable, but
we cannot do that in a shell script).

Signed-off-by: Dennis Ameling <dennis@dennisameling.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
@dscho dscho merged commit 58bcd90 into git-for-windows:main May 18, 2021
@dscho
Copy link
Member

dscho commented May 18, 2021

I went ahead and made those changes, and merged it. If things do not quite work as expected, we'll just need another PR, eh? 😄

@dennisameling
Copy link
Contributor Author

Thanks for making those changes! Quick test is looking good:

$ cmd/git.exe update-git-for-windows --gui
Dennis's fork 2.31.1.windows.1 (ARM64)
Update 2.31.2.windows.1 is available

Indeed downloads from the right path: https://github.com/dennisameling/git/releases/download/2.31.2.windows.1/Git-2.31.2-ARM64.exe

Great! This is really exciting 😊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants