Skip to content

Adjust the Windows download links #2001

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

Merged
merged 4 commits into from
Apr 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 30 additions & 17 deletions assets/js/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -593,26 +593,39 @@ var Downloads = {
return `<strong>${ago}</strong>, `;
},

adjustFor32BitWindows: function() {
// adjust the auto-link for Windows 32-bit setups
const is32BitWindows = window.session.browser.os === 'Windows'
&& !navigator.userAgent.match(/WOW64|Win64|x64|x86_64/)
if (!is32BitWindows) return;

const link = $('#auto-download-link');
const version = $('#auto-download-version');
const bitness = $('#auto-download-bitness');
const date = $('#auto-download-date');
if (link.length && version.length && bitness.length && date.length) {
bitness.html('32-bit');
link.attr('href', '{{ .Site.Params.windows_installer.installer32.url }}');
version.html('{{ .Site.Params.windows_installer.installer32.version }}');
date.html('{{ .Site.Params.windows_installer.installer32.release_date }}');
}
adjustForWindowsARM64: function() {
/*
* Windows/ARM64 cannot be reliably detected via the User-Agent string;
* Instead, we use the UAData, but that is not available in all browsers.
* For more details, see
* https://github.com/git-for-windows/git-for-windows.github.io/pull/61
*/
if (!navigator.userAgentData) return;

navigator.userAgentData.getHighEntropyValues(['architecture', 'platform', 'bitness'])
.then(function(browser) {
if (
browser.platform !== 'Windows'
|| browser.bitness !== '64'
|| browser.architecture !== 'arm'
) return;

// adjust the auto-link for Windows/ARM64 setups
const link = $('#auto-download-link');
const version = $('#auto-download-version');
const architecture = $('#auto-download-architecture');
const date = $('#auto-download-date');
if (link.length && version.length && architecture.length && date.length) {
architecture.html('ARM64');
link.attr('href', '{{ .Site.Params.windows_installer.installer_arm64.url }}');
version.html('{{ .Site.Params.windows_installer.installer_arm64.version }}');
date.html('{{ .Site.Params.windows_installer.installer_arm64.release_date }}');
}
})
},

postProcessDownloadPage: function() {
Downloads.adjustFor32BitWindows();
Downloads.adjustForWindowsARM64();
$('#relative-release-date').html(Downloads.postProcessReleaseDate);
},
}
Expand Down
16 changes: 8 additions & 8 deletions content/downloads/win.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,26 @@
<div id="main">
<h1>Download for Windows</h1>
<p>
<strong><a id="auto-download-link" href="{{< site-param windows_installer.installer64.url >}}">Click here to download </a></strong>
the latest (<strong id="auto-download-version">{{< site-param windows_installer.installer64.version >}}</strong>)
<strong id="auto-download-bitness">64-bit</strong> version of <strong>Git for Windows</strong>.
<strong><a id="auto-download-link" href="{{< site-param windows_installer.installer_x64.url >}}">Click here to download </a></strong>
the latest (<strong id="auto-download-version">{{< site-param windows_installer.installer_x64.version >}}</strong>)
<strong id="auto-download-architecture">x64</strong> version of <strong>Git for Windows</strong>.
This is the most recent <a href="https://git-for-windows.github.io/">maintained build</a>.
It was released <span id="relative-release-date"></span>on <span id="auto-download-date">{{< site-param windows_installer.installer64.release_date >}}</span>.
It was released <span id="relative-release-date"></span>on <span id="auto-download-date">{{< site-param windows_installer.installer_x64.release_date >}}</span>.
</p>
<h3>Other Git for Windows downloads</h3>
<h4>Standalone Installer</h4>
<p>
<strong><a href="{{< site-param windows_installer.installer32.url >}}">32-bit Git for Windows Setup</a>.</strong>
<strong><a href="{{< site-param windows_installer.installer_x64.url >}}">Git for Windows/x64 Setup</a>.</strong>
</p>
<p>
<strong><a href="{{< site-param windows_installer.installer64.url >}}">64-bit Git for Windows Setup</a>.</strong>
<strong><a href="{{< site-param windows_installer.installer_arm64.url >}}">Git for Windows/ARM64 Setup</a>.</strong>
</p>
<h4>Portable ("thumbdrive edition")</h4>
<p>
<strong><a href="{{< site-param windows_installer.portable32.url >}}">32-bit Git for Windows Portable</a>.</strong>
<strong><a href="{{< site-param windows_installer.portable_x64.url >}}">Git for Windows/x64 Portable</a>.</strong>
</p>
<p>
<strong><a href="{{< site-param windows_installer.portable64.url >}}">64-bit Git for Windows Portable</a>.</strong>
<strong><a href="{{< site-param windows_installer.portable_arm64.url >}}">Git for Windows/ARM64 Portable</a>.</strong>
</p>
<h4>Using winget tool</h4>
<p>
Expand Down
28 changes: 14 additions & 14 deletions hugo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,23 +42,23 @@ params:
release_date: '2021-08-30'
filename: git-2.33.0-intel-universal-mavericks.dmg
windows_installer:
portable32:
filename: PortableGit-2.48.1-32-bit.7z.exe
release_date: '2025-02-13'
version: 2.48.1
url: https://github.com/git-for-windows/git/releases/download/v2.48.1.windows.1/PortableGit-2.48.1-32-bit.7z.exe
portable64:
installer_x64:
filename: Git-2.49.0-64-bit.exe
release_date: '2025-03-17'
version: 2.49.0
url: https://github.com/git-for-windows/git/releases/download/v2.49.0.windows.1/Git-2.49.0-64-bit.exe
installer_arm64:
filename: Git-2.49.0-arm64.exe
release_date: '2025-03-17'
version: 2.49.0
url: https://github.com/git-for-windows/git/releases/download/v2.49.0.windows.1/Git-2.49.0-arm64.exe
portable_x64:
filename: PortableGit-2.49.0-64-bit.7z.exe
release_date: '2025-03-17'
version: 2.49.0
url: https://github.com/git-for-windows/git/releases/download/v2.49.0.windows.1/PortableGit-2.49.0-64-bit.7z.exe
installer32:
filename: Git-2.48.1-32-bit.exe
release_date: '2025-02-13'
version: 2.48.1
url: https://github.com/git-for-windows/git/releases/download/v2.48.1.windows.1/Git-2.48.1-32-bit.exe
installer64:
filename: Git-2.49.0-64-bit.exe
portable_arm64:
filename: PortableGit-2.49.0-arm64.7z.exe
release_date: '2025-03-17'
version: 2.49.0
url: https://github.com/git-for-windows/git/releases/download/v2.49.0.windows.1/Git-2.49.0-64-bit.exe
url: https://github.com/git-for-windows/git/releases/download/v2.49.0.windows.1/PortableGit-2.49.0-arm64.7z.exe
2 changes: 1 addition & 1 deletion layouts/partials/monitor.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ <h4> Latest source Release </h4>
<span class="release-date">
({{ .Site.Params.latest_release_date }})
</span>
<span data-mac="{{ .Site.Params.macos_installer.version }}" data-win="{{ .Site.Params.windows_installer.installer64.version }}" id="installer-version"></span>
<span data-mac="{{ .Site.Params.macos_installer.version }}" data-win="{{ .Site.Params.windows_installer.installer_x64.version }}" id="installer-version"></span>

<a href="https://www.kernel.org/pub/software/scm/git/" class="button" id="download-link">Download Source Code</a>
</div>
11 changes: 6 additions & 5 deletions script/update-download-data.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class DownloadData
# name, version, url & date with Feedzirra
SOURCEFORGE_URL = "https://sourceforge.net/projects/git-osx-installer/rss?limit=20"

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

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

next unless match

portable = match[1]
bitness = match[3]
architecture = match[3]
architecture = "x64" if architecture == "64-bit"

# Git for windows sometimes creates extra releases all based off of the same upstream Git version
# so we first want to crop versions like 2.16.1.4 to just 2.16.1
Expand All @@ -44,9 +45,9 @@ def update_download_windows_versions(config)
config["windows_installer"] = {} if config["windows_installer"].nil?
win_config = config["windows_installer"]
if portable.empty?
key = "installer#{bitness}"
key = "installer_#{architecture}"
else
key = "portable#{bitness}"
key = "portable_#{architecture}"
end
win_config[key] = {} if win_config[key].nil?
return if version_compare(version, win_config[key]["version"]) < 0
Expand Down
Loading