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 for Windows Version information #5319

Open
1 task done
AScott-WWF opened this issue Dec 17, 2024 · 4 comments
Open
1 task done

Git for Windows Version information #5319

AScott-WWF opened this issue Dec 17, 2024 · 4 comments

Comments

@AScott-WWF
Copy link

AScott-WWF commented Dec 17, 2024

  • I was not able to find an open or closed issue matching what I'm seeing

Setup

  • Which version of Git for Windows are you using? Is it 32-bit or 64-bit?
$ git --version --build-options

git version 2.47.1.windows.1
cpu: x86_64
built from commit: 2cd22437f64229935dc564db969cbcbfed5e9045
sizeof-long: 4
sizeof-size_t: 8
shell-path: D:/git-sdk-64-build-installers/usr/bin/sh
feature: fsmonitor--daemon
libcurl: 8.11.0
OpenSSL: OpenSSL 3.2.3 3 Sep 2024
zlib: 1.3.1
  • Which version of Windows are you running? Vista, 7, 8, 10? Is it 32-bit or 64-bit?
$ cmd.exe /c ver

Microsoft Windows [Version 10.0.19045.5247]

Windows 10 Enterprise Version 22H2 64-bit

  • What options did you set as part of the installation? Or did you choose the
    defaults?
# One of the following:
> type "C:\Program Files\Git\etc\install-options.txt"
> type "C:\Program Files (x86)\Git\etc\install-options.txt"
> type "%USERPROFILE%\AppData\Local\Programs\Git\etc\install-options.txt"
> type "$env:USERPROFILE\AppData\Local\Programs\Git\etc\install-options.txt"
$ cat /etc/install-options.txt

Editor Option: VisualStudioCode
Custom Editor Path:
Default Branch Option:
Path Option: Cmd
SSH Option: OpenSSH
Tortoise Option: false
CURL Option: OpenSSL
CRLF Option: CRLFAlways
Bash Terminal Option: ConHost
Git Pull Behavior Option: Merge
Use Credential Manager: Enabled
Performance Tweaks FSCache: Enabled
Enable Symlinks: Disabled
Enable FSMonitor: Disabled
  • Any other interesting things about your environment that might be related
    to the issue you're seeing?

N/A

Details

  • Which terminal/shell are you running Git from? e.g Bash/CMD/PowerShell/other

CMD or PowerShell

** PowerShell commands **
cd C:\Program Files\Git
Get-ChildItem git*.exe -Recurse -Force -ErrorAction SilentlyContinue | Select-Object * -ExpandProperty versioninfo | Sort-Object ProductVersion,FileVersionRaw,Filename | Select-Object ProductVersion,FileVersion,FileVersionRaw,Filename,FileDescription,CompanyName | ft -AutoSize

(Get-ItemProperty -Path Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Git_is1\ -Name DisplayVersion).DisplayVersion
  • What did you expect to occur after running these commands?

Consistent Version numbering

  • What actually happened instead?
    The 1st command returns:
ProductVersion                                 FileVersion      FileVersionRaw FileName                                                                 FileDescription        CompanyName
--------------                                 -----------      -------------- --------                                                                 ---------------        -----------
                                                                0.0.0.0        C:\Program Files\Git\mingw64\bin\git-askpass.exe
                                                                0.0.0.0        C:\Program Files\Git\mingw64\bin\git-askyesno.exe
                                                                0.0.0.0        C:\Program Files\Git\mingw64\bin\git-credential-helper-selector.exe
                                                                0.0.0.0        C:\Program Files\Git\mingw64\libexec\git-core\git-credential-wincred.exe
                                                                3.6.0.0        C:\Program Files\Git\mingw64\bin\git-lfs.exe
2.47.1.windows.1                               2.47.1.windows.1 2.47.1.1       C:\Program Files\Git\bin\git.exe                                         Git for Windows        The Git Development Community
2.47.1.windows.1                               2.47.1.windows.1 2.47.1.1       C:\Program Files\Git\cmd\git-gui.exe                                     Git for Windows        The Git Development Community
2.47.1.windows.1                               2.47.1.windows.1 2.47.1.1       C:\Program Files\Git\cmd\git-lfs.exe                                     Git for Windows        The Git Development Community
2.47.1.windows.1                               2.47.1.windows.1 2.47.1.1       C:\Program Files\Git\cmd\git-receive-pack.exe                            Git for Windows        The Git Development Community
2.47.1.windows.1                               2.47.1.windows.1 2.47.1.1       C:\Program Files\Git\cmd\git-upload-pack.exe                             Git for Windows        The Git Development Community
2.47.1.windows.1                               2.47.1.windows.1 2.47.1.1       C:\Program Files\Git\cmd\git.exe                                         Git for Windows        The Git Development Community
2.47.1.windows.1                               2.47.1.windows.1 2.47.1.1       C:\Program Files\Git\cmd\gitk.exe                                        Git for Windows        The Git Development Community
2.47.1.windows.1                               2.47.1.windows.1 2.47.1.1       C:\Program Files\Git\git-bash.exe                                        Git for Windows        The Git Development Community
2.47.1.windows.1                               2.47.1.windows.1 2.47.1.1       C:\Program Files\Git\git-cmd.exe                                         Git for Windows        The Git Development Community
2.47.1.windows.1                               2.47.1.windows.1 2.47.1.1       C:\Program Files\Git\mingw64\bin\git-receive-pack.exe                    Git for Windows        The Git Development Community
2.47.1.windows.1                               2.47.1.windows.1 2.47.1.1       C:\Program Files\Git\mingw64\bin\git-upload-archive.exe                  Git for Windows        The Git Development Community
2.47.1.windows.1                               2.47.1.windows.1 2.47.1.1       C:\Program Files\Git\mingw64\bin\git-upload-pack.exe                     Git for Windows        The Git Development Community
2.47.1.windows.1                               2.47.1.windows.1 2.47.1.1       C:\Program Files\Git\mingw64\bin\git.exe                                 Git for Windows        The Git Development Community
2.47.1.windows.1                               2.47.1.windows.1 2.47.1.1       C:\Program Files\Git\mingw64\libexec\git-core\git-daemon.exe             Git for Windows        The Git Development Community
2.47.1.windows.1                               2.47.1.windows.1 2.47.1.1       C:\Program Files\Git\mingw64\libexec\git-core\git-http-backend.exe       Git for Windows        The Git Development Community
2.47.1.windows.1                               2.47.1.windows.1 2.47.1.1       C:\Program Files\Git\mingw64\libexec\git-core\git-http-fetch.exe         Git for Windows        The Git Development Community
2.47.1.windows.1                               2.47.1.windows.1 2.47.1.1       C:\Program Files\Git\mingw64\libexec\git-core\git-http-push.exe          Git for Windows        The Git Development Community
2.47.1.windows.1                               2.47.1.windows.1 2.47.1.1       C:\Program Files\Git\mingw64\libexec\git-core\git-imap-send.exe          Git for Windows        The Git Development Community
2.47.1.windows.1                               2.47.1.windows.1 2.47.1.1       C:\Program Files\Git\mingw64\libexec\git-core\git-remote-ftp.exe         Git for Windows        The Git Development Community
2.47.1.windows.1                               2.47.1.windows.1 2.47.1.1       C:\Program Files\Git\mingw64\libexec\git-core\git-remote-ftps.exe        Git for Windows        The Git Development Community
2.47.1.windows.1                               2.47.1.windows.1 2.47.1.1       C:\Program Files\Git\mingw64\libexec\git-core\git-remote-http.exe        Git for Windows        The Git Development Community
2.47.1.windows.1                               2.47.1.windows.1 2.47.1.1       C:\Program Files\Git\mingw64\libexec\git-core\git-remote-https.exe       Git for Windows        The Git Development Community
2.47.1.windows.1                               2.47.1.windows.1 2.47.1.1       C:\Program Files\Git\mingw64\libexec\git-core\git-sh-i18n--envsubst.exe  Git for Windows        The Git Development Community
2.47.1.windows.1                               2.47.1.windows.1 2.47.1.1       C:\Program Files\Git\mingw64\libexec\git-core\git.exe                    Git for Windows        The Git Development Community
2.47.1.windows.1                               2.47.1.windows.1 2.47.1.1       C:\Program Files\Git\mingw64\share\git\git-wrapper.exe                   Git for Windows        The Git Development Community
2.6.0+3c28096588f549cb46f36b552390514356830abe 2.6.0.0          2.6.0.0        C:\Program Files\Git\mingw64\bin\git-credential-manager.exe              git-credential-manager git-credential-manager

As you can see (for any of the latest Git components) this is either "2.47.1.windows.1" for ProductVersion or FileVersion, but "2.47.1.1" for FileVersionRaw
Whereas the 2nd Command returns "2.47.1" from the DisplayVersion held in the registry

2.47.1
  • If the problem was occurring with a specific repository, can you provide the
    URL to that repository to help us with testing?

N/A

The problem with this inconsistency is it makes it very difficult to use 'standard' Windows checks to determine the version of the product that is actually installed, As an example we use Microsoft Intune to deploy software to many endpoints and one of the detection methods available to us when a product is deployed is to use a String (Version) check against a defined file (e.g. C:\Program Files\Git\git-cmd.exe), this checks for a standard 4 part version number held in the FileVersion attribute on the chosen file.
As you can see from the above results the FileVersion on your files contains 5 parts. This unfortunately is not a normal 'Windows' defined version number (i.e. Major.Minor.Build.Revision), so this check fails (Unfortunately Intune (and many other deployment tools) does not give the option to choose an (alternative) attribute to use) so for Git for Windows the FileVersion attribute can not be used to detect the installed version.

One question I do have is what is the actual [version] number for this release? is it 2.47.1, 2.47.1.1 or something else?
If it is something else (i.e. "2.47.1.windows.1") I need to find a native Windows method to return the correct standard Windows version number.
One solution I could recommend is for your development build process to put the standard Windows format numeric version number (e.g. 2.47.1.1 into the FileVersion Attribute on your windows compiled executables (.exe) and dynamic linked librarys (.dll) and leave the Product Version as-is, that way many products that attempt to read the version info from an executable or dll file can correctly determine it.

@dscho
Copy link
Member

dscho commented Dec 17, 2024

The reason why Git for Windows v2.47.1 is internally labeled "v2.47.1.1" or "v2.47.1.windows.1" is that there are a metric ton of patches on top of Git v2.47.1. The .1, therefore, tries to indicate that there is no patch level zero of Git for Windows, it always starts at one. And since it always starts at one, it can be omitted unless it is two or higher.

@AScott-WWF
Copy link
Author

Thank You, that answers the 'actual version' question ;-)

Would you therefore be able to do anything about populating the FileVersion attribute on any Git for Windows executables & DLL's with this correct version 2.47.1 (or subsequent 2.47.1.2 etc) going forward, rather than the incorrect formatting for a Windows file version e.g. 2.47.1.windows.1?
As this small change could make file version checks sooo much easier to handle

@dscho
Copy link
Member

dscho commented Dec 17, 2024

I am quite sure that I have more pressing things to take care of; This feature request does not strike me as meeting the bar to drop those more pressing issues in favor of changing the way the version is encoded. As far as I can tell, Git for Windows' version information is consistent enough. If you feel strongly enough, I invite you to invest your own time on this project.

@AScott-WWF
Copy link
Author

AScott-WWF commented Dec 17, 2024

Apologies, I did not mean to offend or cause you extra stress, I was simply highlighting that the application has the version encoding into the FileVersion attribute in the incorrect format for a standard 2, 3 or 4 part Windows File Version.
From your very helpful reply, I now know that the current version is 2.47.1, so I can (hopefully) rely on using the version number obtained from the registry uninstall path for this purpose moving forwards.

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

No branches or pull requests

2 participants