Skip to content

Commit 617d12c

Browse files
authored
Merge pull request #2001 from dscho/adjust-windows-download-links-again
Adjust the Windows download links
2 parents 20f6eb1 + d859fc7 commit 617d12c

File tree

5 files changed

+59
-45
lines changed

5 files changed

+59
-45
lines changed

assets/js/application.js

Lines changed: 30 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -593,26 +593,39 @@ var Downloads = {
593593
return `<strong>${ago}</strong>, `;
594594
},
595595

596-
adjustFor32BitWindows: function() {
597-
// adjust the auto-link for Windows 32-bit setups
598-
const is32BitWindows = window.session.browser.os === 'Windows'
599-
&& !navigator.userAgent.match(/WOW64|Win64|x64|x86_64/)
600-
if (!is32BitWindows) return;
601-
602-
const link = $('#auto-download-link');
603-
const version = $('#auto-download-version');
604-
const bitness = $('#auto-download-bitness');
605-
const date = $('#auto-download-date');
606-
if (link.length && version.length && bitness.length && date.length) {
607-
bitness.html('32-bit');
608-
link.attr('href', '{{ .Site.Params.windows_installer.installer32.url }}');
609-
version.html('{{ .Site.Params.windows_installer.installer32.version }}');
610-
date.html('{{ .Site.Params.windows_installer.installer32.release_date }}');
611-
}
596+
adjustForWindowsARM64: function() {
597+
/*
598+
* Windows/ARM64 cannot be reliably detected via the User-Agent string;
599+
* Instead, we use the UAData, but that is not available in all browsers.
600+
* For more details, see
601+
* https://github.com/git-for-windows/git-for-windows.github.io/pull/61
602+
*/
603+
if (!navigator.userAgentData) return;
604+
605+
navigator.userAgentData.getHighEntropyValues(['architecture', 'platform', 'bitness'])
606+
.then(function(browser) {
607+
if (
608+
browser.platform !== 'Windows'
609+
|| browser.bitness !== '64'
610+
|| browser.architecture !== 'arm'
611+
) return;
612+
613+
// adjust the auto-link for Windows/ARM64 setups
614+
const link = $('#auto-download-link');
615+
const version = $('#auto-download-version');
616+
const architecture = $('#auto-download-architecture');
617+
const date = $('#auto-download-date');
618+
if (link.length && version.length && architecture.length && date.length) {
619+
architecture.html('ARM64');
620+
link.attr('href', '{{ .Site.Params.windows_installer.installer_arm64.url }}');
621+
version.html('{{ .Site.Params.windows_installer.installer_arm64.version }}');
622+
date.html('{{ .Site.Params.windows_installer.installer_arm64.release_date }}');
623+
}
624+
})
612625
},
613626

614627
postProcessDownloadPage: function() {
615-
Downloads.adjustFor32BitWindows();
628+
Downloads.adjustForWindowsARM64();
616629
$('#relative-release-date').html(Downloads.postProcessReleaseDate);
617630
},
618631
}

content/downloads/win.html

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,26 +8,26 @@
88
<div id="main">
99
<h1>Download for Windows</h1>
1010
<p>
11-
<strong><a id="auto-download-link" href="{{< site-param windows_installer.installer64.url >}}">Click here to download </a></strong>
12-
the latest (<strong id="auto-download-version">{{< site-param windows_installer.installer64.version >}}</strong>)
13-
<strong id="auto-download-bitness">64-bit</strong> version of <strong>Git for Windows</strong>.
11+
<strong><a id="auto-download-link" href="{{< site-param windows_installer.installer_x64.url >}}">Click here to download </a></strong>
12+
the latest (<strong id="auto-download-version">{{< site-param windows_installer.installer_x64.version >}}</strong>)
13+
<strong id="auto-download-architecture">x64</strong> version of <strong>Git for Windows</strong>.
1414
This is the most recent <a href="https://git-for-windows.github.io/">maintained build</a>.
15-
It was released <span id="relative-release-date"></span>on <span id="auto-download-date">{{< site-param windows_installer.installer64.release_date >}}</span>.
15+
It was released <span id="relative-release-date"></span>on <span id="auto-download-date">{{< site-param windows_installer.installer_x64.release_date >}}</span>.
1616
</p>
1717
<h3>Other Git for Windows downloads</h3>
1818
<h4>Standalone Installer</h4>
1919
<p>
20-
<strong><a href="{{< site-param windows_installer.installer32.url >}}">32-bit Git for Windows Setup</a>.</strong>
20+
<strong><a href="{{< site-param windows_installer.installer_x64.url >}}">Git for Windows/x64 Setup</a>.</strong>
2121
</p>
2222
<p>
23-
<strong><a href="{{< site-param windows_installer.installer64.url >}}">64-bit Git for Windows Setup</a>.</strong>
23+
<strong><a href="{{< site-param windows_installer.installer_arm64.url >}}">Git for Windows/ARM64 Setup</a>.</strong>
2424
</p>
2525
<h4>Portable ("thumbdrive edition")</h4>
2626
<p>
27-
<strong><a href="{{< site-param windows_installer.portable32.url >}}">32-bit Git for Windows Portable</a>.</strong>
27+
<strong><a href="{{< site-param windows_installer.portable_x64.url >}}">Git for Windows/x64 Portable</a>.</strong>
2828
</p>
2929
<p>
30-
<strong><a href="{{< site-param windows_installer.portable64.url >}}">64-bit Git for Windows Portable</a>.</strong>
30+
<strong><a href="{{< site-param windows_installer.portable_arm64.url >}}">Git for Windows/ARM64 Portable</a>.</strong>
3131
</p>
3232
<h4>Using winget tool</h4>
3333
<p>

hugo.yml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -42,23 +42,23 @@ params:
4242
release_date: '2021-08-30'
4343
filename: git-2.33.0-intel-universal-mavericks.dmg
4444
windows_installer:
45-
portable32:
46-
filename: PortableGit-2.48.1-32-bit.7z.exe
47-
release_date: '2025-02-13'
48-
version: 2.48.1
49-
url: https://github.com/git-for-windows/git/releases/download/v2.48.1.windows.1/PortableGit-2.48.1-32-bit.7z.exe
50-
portable64:
45+
installer_x64:
46+
filename: Git-2.49.0-64-bit.exe
47+
release_date: '2025-03-17'
48+
version: 2.49.0
49+
url: https://github.com/git-for-windows/git/releases/download/v2.49.0.windows.1/Git-2.49.0-64-bit.exe
50+
installer_arm64:
51+
filename: Git-2.49.0-arm64.exe
52+
release_date: '2025-03-17'
53+
version: 2.49.0
54+
url: https://github.com/git-for-windows/git/releases/download/v2.49.0.windows.1/Git-2.49.0-arm64.exe
55+
portable_x64:
5156
filename: PortableGit-2.49.0-64-bit.7z.exe
5257
release_date: '2025-03-17'
5358
version: 2.49.0
5459
url: https://github.com/git-for-windows/git/releases/download/v2.49.0.windows.1/PortableGit-2.49.0-64-bit.7z.exe
55-
installer32:
56-
filename: Git-2.48.1-32-bit.exe
57-
release_date: '2025-02-13'
58-
version: 2.48.1
59-
url: https://github.com/git-for-windows/git/releases/download/v2.48.1.windows.1/Git-2.48.1-32-bit.exe
60-
installer64:
61-
filename: Git-2.49.0-64-bit.exe
60+
portable_arm64:
61+
filename: PortableGit-2.49.0-arm64.7z.exe
6262
release_date: '2025-03-17'
6363
version: 2.49.0
64-
url: https://github.com/git-for-windows/git/releases/download/v2.49.0.windows.1/Git-2.49.0-64-bit.exe
64+
url: https://github.com/git-for-windows/git/releases/download/v2.49.0.windows.1/PortableGit-2.49.0-arm64.7z.exe

layouts/partials/monitor.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ <h4> Latest source Release </h4>
1010
<span class="release-date">
1111
({{ .Site.Params.latest_release_date }})
1212
</span>
13-
<span data-mac="{{ .Site.Params.macos_installer.version }}" data-win="{{ .Site.Params.windows_installer.installer64.version }}" id="installer-version"></span>
13+
<span data-mac="{{ .Site.Params.macos_installer.version }}" data-win="{{ .Site.Params.windows_installer.installer_x64.version }}" id="installer-version"></span>
1414

1515
<a href="https://www.kernel.org/pub/software/scm/git/" class="button" id="download-link">Download Source Code</a>
1616
</div>

script/update-download-data.rb

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class DownloadData
1515
# name, version, url & date with Feedzirra
1616
SOURCEFORGE_URL = "https://sourceforge.net/projects/git-osx-installer/rss?limit=20"
1717

18-
GIT_FOR_WINDOWS_REGEX = /^(Portable|)Git-(\d+\.\d+\.\d+(?:\.\d+)?)-(?:.+-)*(32|64)-bit(?:\..*)?\.exe/
18+
GIT_FOR_WINDOWS_REGEX = /^(Portable|)Git-(\d+\.\d+\.\d+(?:\.\d+)?)-(?:.+-)*(64-bit|arm64)(?:\..*)?\.exe/
1919
GIT_FOR_WINDOWS_NAME_WITH_OWNER = "git-for-windows/git"
2020

2121
class << self
@@ -26,13 +26,14 @@ def sourceforge_project_download_url(project, filename)
2626
def update_download_windows_versions(config)
2727
files_from_github(GIT_FOR_WINDOWS_NAME_WITH_OWNER).each do |name, date, url|
2828
# Git for Windows uses the following naming system
29-
# [Portable]Git-#.#.#.#[-dev-preview]-32/64-bit[.7z].exe
29+
# [Portable]Git-#.#.#.#[-dev-preview]-64-bit/arm64[.7z].exe
3030
match = GIT_FOR_WINDOWS_REGEX.match(name)
3131

3232
next unless match
3333

3434
portable = match[1]
35-
bitness = match[3]
35+
architecture = match[3]
36+
architecture = "x64" if architecture == "64-bit"
3637

3738
# Git for windows sometimes creates extra releases all based off of the same upstream Git version
3839
# so we first want to crop versions like 2.16.1.4 to just 2.16.1
@@ -44,9 +45,9 @@ def update_download_windows_versions(config)
4445
config["windows_installer"] = {} if config["windows_installer"].nil?
4546
win_config = config["windows_installer"]
4647
if portable.empty?
47-
key = "installer#{bitness}"
48+
key = "installer_#{architecture}"
4849
else
49-
key = "portable#{bitness}"
50+
key = "portable_#{architecture}"
5051
end
5152
win_config[key] = {} if win_config[key].nil?
5253
return if version_compare(version, win_config[key]["version"]) < 0

0 commit comments

Comments
 (0)