mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-01-08 04:04:22 +02:00
better error for nonbackwards compatible changes
This commit is contained in:
parent
d8aba3aeee
commit
42500817e0
@ -329,7 +329,7 @@ func addEnglish(i18nObject *i18n.Bundle) error {
|
|||||||
Other: "You already have the latest version",
|
Other: "You already have the latest version",
|
||||||
}, &i18n.Message{
|
}, &i18n.Message{
|
||||||
ID: "MajorVersionErr",
|
ID: "MajorVersionErr",
|
||||||
Other: "New version has non-backwards compatible changes.",
|
Other: "New version ({{.newVersion}}) has non-backwards compatible changes compared to the current version ({{.currentVersion}})",
|
||||||
}, &i18n.Message{
|
}, &i18n.Message{
|
||||||
ID: "CouldNotFindBinaryErr",
|
ID: "CouldNotFindBinaryErr",
|
||||||
Other: "Could not find any binary at {{.url}}",
|
Other: "Could not find any binary at {{.url}}",
|
||||||
|
@ -96,6 +96,7 @@ func (u *Updater) majorVersionDiffers(oldVersion, newVersion string) bool {
|
|||||||
|
|
||||||
func (u *Updater) checkForNewUpdate() (string, error) {
|
func (u *Updater) checkForNewUpdate() (string, error) {
|
||||||
u.Log.Info("Checking for an updated version")
|
u.Log.Info("Checking for an updated version")
|
||||||
|
currentVersion := u.Config.GetVersion()
|
||||||
if err := u.RecordLastUpdateCheck(); err != nil {
|
if err := u.RecordLastUpdateCheck(); err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
@ -104,15 +105,22 @@ func (u *Updater) checkForNewUpdate() (string, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
u.Log.Info("Current version is " + u.Config.GetVersion())
|
u.Log.Info("Current version is " + currentVersion)
|
||||||
u.Log.Info("New version is " + newVersion)
|
u.Log.Info("New version is " + newVersion)
|
||||||
|
|
||||||
if newVersion == u.Config.GetVersion() {
|
if newVersion == currentVersion {
|
||||||
return "", errors.New(u.Tr.SLocalize("OnLatestVersionErr"))
|
return "", errors.New(u.Tr.SLocalize("OnLatestVersionErr"))
|
||||||
}
|
}
|
||||||
|
|
||||||
if u.majorVersionDiffers(u.Config.GetVersion(), newVersion) {
|
if u.majorVersionDiffers(currentVersion, newVersion) {
|
||||||
return "", errors.New(u.Tr.SLocalize("MajorVersionErr"))
|
errMessage := u.Tr.TemplateLocalize(
|
||||||
|
"MajorVersionErr",
|
||||||
|
i18n.Teml{
|
||||||
|
"newVersion": newVersion,
|
||||||
|
"currentVersion": currentVersion,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
return "", errors.New(errMessage)
|
||||||
}
|
}
|
||||||
|
|
||||||
rawUrl, err := u.getBinaryUrl(newVersion)
|
rawUrl, err := u.getBinaryUrl(newVersion)
|
||||||
|
Loading…
Reference in New Issue
Block a user