mirror of
				https://github.com/jesseduffield/lazygit.git
				synced 2025-10-30 23:57:43 +02:00 
			
		
		
		
	better error for nonbackwards compatible changes
This commit is contained in:
		| @@ -329,7 +329,7 @@ func addEnglish(i18nObject *i18n.Bundle) error { | ||||
| 			Other: "You already have the latest version", | ||||
| 		}, &i18n.Message{ | ||||
| 			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{ | ||||
| 			ID:    "CouldNotFindBinaryErr", | ||||
| 			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) { | ||||
| 	u.Log.Info("Checking for an updated version") | ||||
| 	currentVersion := u.Config.GetVersion() | ||||
| 	if err := u.RecordLastUpdateCheck(); err != nil { | ||||
| 		return "", err | ||||
| 	} | ||||
| @@ -104,15 +105,22 @@ func (u *Updater) checkForNewUpdate() (string, error) { | ||||
| 	if err != nil { | ||||
| 		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) | ||||
|  | ||||
| 	if newVersion == u.Config.GetVersion() { | ||||
| 	if newVersion == currentVersion { | ||||
| 		return "", errors.New(u.Tr.SLocalize("OnLatestVersionErr")) | ||||
| 	} | ||||
|  | ||||
| 	if u.majorVersionDiffers(u.Config.GetVersion(), newVersion) { | ||||
| 		return "", errors.New(u.Tr.SLocalize("MajorVersionErr")) | ||||
| 	if u.majorVersionDiffers(currentVersion, newVersion) { | ||||
| 		errMessage := u.Tr.TemplateLocalize( | ||||
| 			"MajorVersionErr", | ||||
| 			i18n.Teml{ | ||||
| 				"newVersion":     newVersion, | ||||
| 				"currentVersion": currentVersion, | ||||
| 			}, | ||||
| 		) | ||||
| 		return "", errors.New(errMessage) | ||||
| 	} | ||||
|  | ||||
| 	rawUrl, err := u.getBinaryUrl(newVersion) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user