jesseduffield / lazygit

simple terminal UI for git commands
MIT License
53.23k stars 1.86k forks source link

Check Update key does not work #4046

Open lcc014 opened 1 week ago

lcc014 commented 1 week ago

with the latest version, 0.44.1, I tried the "check update" key - u. Nothing happened.

In early release, it would pop up a dialog box to indicate any available update or not. Help menu indicated that "u" for checking update in Status window [1].

aaronjconway commented 1 week ago

There's a few checks that prevent updates. I had no issue with using "u" on status screen. When on 44.1 nothing will happen since most recent version.

func (u *Updater) skipUpdateCheck() bool {
    // will remove the check for windows after adding a manifest file asking for
    // the required permissions
    if runtime.GOOS == "windows" {
        u.Log.Info("Updating is currently not supported for windows until we can fix permission issues")
        return true
    }

    if u.Config.GetVersion() == "unversioned" {
        u.Log.Info("Current version is not built from an official release so we won't check for an update")
        return true
    }

    if u.Config.GetBuildSource() != "buildBinary" {
        u.Log.Info("Binary is not built with the buildBinary flag so we won't check for an update")
        return true
    }

    userConfig := u.UserConfig()
    if userConfig.Update.Method == "never" {
        u.Log.Info("Update method is set to never so we won't check for an update")
        return true
    }

    currentTimestamp := time.Now().Unix()
    lastUpdateCheck := u.Config.GetAppState().LastUpdateCheck
    days := userConfig.Update.Days

    if (currentTimestamp-lastUpdateCheck)/(60*60*24) < days {
        u.Log.Info("Last update was too recent so we won't check for an update")
        return true
    }

    return false
}