-
Notifications
You must be signed in to change notification settings - Fork 613
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
Installer: stop complaining about "downgrading" when upgrading from an rc version #264
Installer: stop complaining about "downgrading" when upgrading from an rc version #264
Conversation
This makes things easier when reading back the output from a command that we just let redirect its output into a file. Signed-off-by: Johannes Schindelin <[email protected]>
A Git tag has a slightly different format from the one `VersionCompare()` currently expects: A Git for Windows tag usually has the `.windows.<patch-level>` suffix, and Git versions can have the `.rc<N>` suffix. Let's just skip identical non-numerical substrings when comparing versions. This also fixes the (theoretical) bug where `2.19a` and `2.19b` would have been treated as identical versions. Note: to allow for comparing, say, `v2.24.0.rc1.windows.1` to `v2.24.0.windows.1`, we willfully rely on the fact that `r` has a lower numerical value in ASCII than `w`. Signed-off-by: Johannes Schindelin <[email protected]>
When upgrading from, say, v2.24.0-rc2 to v2.24.0, we definitely do _not_ want a bogus "do you want to downgrade" warning. To help the existing test, let's include the output of the `git version` command and compare it with the just-enhanced `VersionCompare()` function to the output of the to-be-upgraded Git for Windows version. Signed-off-by: Johannes Schindelin <[email protected]>
@webstech could you have a look, too? You've been the second-most active developer in this area in the past year... |
I had a quick read through https://patch-diff.githubusercontent.com/raw/git-for-windows/build-extra/pull/264.patch and saw nothing objectionable. There were a couple of bits I wasn't familiar with (i.e. stuff I could use as a learning point, e.g. why the |
Cool, cool! The The There are more things that are defined in I did realize on a walk I just took that I failed to account for downgrades to rc versions. In those cases, we would compare the installed version (e.g. Will work on that and update the PR. |
The `-rc<N>` versions reduce to a registry value `CurrentVersion` that looks like it is a _later_ version than the final version. Example: v2.24.0.windows.1 would reduce to `2.24.0.1` while v2.24.0.rc2.windows.1` would reduce to `2.24.0.2.1`, i.e. the -rc2 version would be mistaken for being an _upgrade_ relative to the final v2.24.0. To fix this, let's detect whether the version we are about to install, or the version we want to upgrade, are potentially `-rc<N>` versions, simply by counting the dots, and fall back to the (a little bit more expensive) test via `git version` if that is the case. Signed-off-by: Johannes Schindelin <[email protected]>
@PhilipOakley there you go: dbbfe25 |
FWIW I want to merge this in time for v2.24.0 (and designed the PR that way, my initial idea was to write a registry entry in To make sure that this gets a lot of eyes, I will request reviews from a range of potential reviewers, hoping that this PR will get a lot of scrutiny. |
I find this way of doing version comparisons a bit brittle and hardly extensible (imagine if we had alpha and beta version numbers). The "right" way would be to build a tuple (prio, number) out of each segment of the version string. Stand-alone numbers get a high prio, rcN gets one less, beta and alpha one less each as well. Then you compare the list of tuples from left to right. Other than that, the patches seem to do what you intend :-) |
Hadn't appreciated that part (I think you are saying this is dynamic at install time..?) Hmm, re-reading, I see that that part (the |
I'd rather cross that bridge when (if?) we need to... Think YAGNI. It would require a ton of work: we would need to build a new class for that, non-trivial parsing, etc. And: no regression test suite we can use to build/maintain confidence...
👍
Yes, And yes, the two different types of |
> > @@ -119,6 +119,11 @@ else
> > die "Could not generate file list"
> > fi
> >
> > +cmd_git="$(echo "$LIST" | grep '^cmd/git\.exe$')"
>
> Will this get an error if the --skip-files option is specified? I understand that is not part of a normal build of the install.
Well, the `grep` might fail, but the exit code is ignored.
|
Thank you all, reviewers! |
The Git for Windows installer [no longer complains about a downgrade](#264) when upgrading from an `-rc` version, i.e. from a pre-release leading up to the next major version. Signed-off-by: Johannes Schindelin <[email protected]>
There is a pretty old bug where the Git for Windows installer warns about a "downgrade" when upgrading from, say, v2.23.0-rc2 to v2.23.0, because the versions that are actually compared are of the format
N.N.N.N
(by stripping out non-numerical letters, in the example, the compared versions would be2.23.0.2
vs2.23.0.0
).Let's fix this by trying to be a bit more careful when we're about to warn about a downgrade, and compare the output of the installed
git version
vs the one we're about to install.