Skip to content

Commit

Permalink
update-download-data: accommodate for Git for Windows' four-part vers…
Browse files Browse the repository at this point in the history
…ion format

Git for Windows' versions are usually based on upstream Git versions,
and hence uses the same version string.

Every once in a while, an extra version is required, in which case Git
for Windows appends an extra number in parentheses, starting with 2
(implying that regular Git for Windows versions are implicitly "(1)"),
at least where parentheses can be used (otherwise it appends it
separated by a dot).

Accommodate for such versions in the script that wants to update the
download data.

Signed-off-by: Johannes Schindelin <[email protected]>
  • Loading branch information
dscho committed Oct 26, 2024
1 parent faa0a7a commit 9969712
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions script/update-download-data.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,10 @@ def update_download_windows_versions(config)
bitness = match[3]

# Git for windows sometimes creates extra releases all based off of the same upstream Git version
# so we want to crop versions like 2.16.1.4 to just 2.16.1
# so we first want to crop versions like 2.16.1.4 to just 2.16.1
version = match[2].slice(/^\d+\.\d+\.\d+/)
# Now, as per Git for Windows' custom, append the fourth part in parens, e.g. 2.16.1(4)
version += "(#{match[2].slice(version.length + 1)})" if match[2][version.length] == "."

if version
config["windows_installer"] = {} if config["windows_installer"].nil?
Expand Down Expand Up @@ -119,8 +121,8 @@ def files_from_sourceforge(repository)
end

def version_compare(a, b)
a = a.nil? ? [] : a.gsub(/^v/, "").split(/\./)
b = b.nil? ? [] : b.gsub(/^v/, "").split(/\./)
a = a.nil? ? [] : a.gsub(/^v/, "").split(/[.()]/)
b = b.nil? ? [] : b.gsub(/^v/, "").split(/[.()]/)
while true
a0 = a.shift
b0 = b.shift
Expand Down

0 comments on commit 9969712

Please sign in to comment.