merge upstream

This commit is contained in:
meiji163 2022-03-07 17:58:48 -08:00
parent aad291a3b8
commit 65bc3acaa5
2 changed files with 1 additions and 42 deletions

View file

@ -76,6 +76,7 @@ func NewCmdExtension(f *cmdutil.Factory) *cobra.Command {
if c.UpdateAvailable() {
updateAvailable = "Upgrade available"
}
t.AddField(updateAvailable, nil, cs.Green)
t.EndRow()
}
return t.Render()

View file

@ -198,13 +198,7 @@ func (m *Manager) parseBinaryExtensionDir(fi fs.FileInfo) (Extension, error) {
remoteURL := ghrepo.GenerateRepoURL(repo, "")
ext.url = remoteURL
ext.currentVersion = bm.Tag
<<<<<<< HEAD
if bm.Pinned {
ext.pin = bm.Tag
}
=======
ext.isPinned = bm.IsPinned
>>>>>>> tmp
return ext, nil
}
@ -214,17 +208,10 @@ func (m *Manager) parseGitExtensionDir(fi fs.FileInfo) (Extension, error) {
remoteUrl := m.getRemoteUrl(fi.Name())
currentVersion := m.getCurrentVersion(fi.Name())
<<<<<<< HEAD
var pinnedVersion string
pinPath := filepath.Join(id, fi.Name(), fmt.Sprintf(".pin-%s", currentVersion))
if _, err := os.Stat(pinPath); err == nil && len(currentVersion) > 6 {
pinnedVersion = currentVersion[:7]
=======
var isPinned bool
pinPath := filepath.Join(id, fi.Name(), fmt.Sprintf(".pin-%s", currentVersion))
if _, err := os.Stat(pinPath); err == nil {
isPinned = true
>>>>>>> tmp
}
return Extension{
@ -233,11 +220,7 @@ func (m *Manager) parseGitExtensionDir(fi fs.FileInfo) (Extension, error) {
isLocal: false,
currentVersion: currentVersion,
kind: GitKind,
<<<<<<< HEAD
pin: pinnedVersion,
=======
isPinned: isPinned,
>>>>>>> tmp
}, nil
}
@ -339,19 +322,11 @@ func (m *Manager) InstallLocal(dir string) error {
}
type binManifest struct {
<<<<<<< HEAD
Owner string
Name string
Host string
Tag string
Pinned bool
=======
Owner string
Name string
Host string
Tag string
IsPinned bool
>>>>>>> tmp
// TODO I may end up not using this; just thinking ahead to local installs
Path string
}
@ -423,21 +398,12 @@ func (m *Manager) installBin(repo ghrepo.Interface, target string) error {
}
manifest := binManifest{
<<<<<<< HEAD
Name: name,
Owner: repo.RepoOwner(),
Host: repo.RepoHost(),
Path: binPath,
Tag: r.Tag,
Pinned: isPinned,
=======
Name: name,
Owner: repo.RepoOwner(),
Host: repo.RepoHost(),
Path: binPath,
Tag: r.Tag,
IsPinned: isPinned,
>>>>>>> tmp
}
bs, err := yaml.Marshal(manifest)
@ -501,11 +467,7 @@ func (m *Manager) installGit(repo ghrepo.Interface, target string, stdout, stder
pinPath := filepath.Join(targetDir, fmt.Sprintf(".pin-%s", commitSHA))
f, err := os.OpenFile(pinPath, os.O_WRONLY|os.O_CREATE, 0600)
if err != nil {
<<<<<<< HEAD
return fmt.Errorf("failed to create pin in directory: %w", err)
=======
return fmt.Errorf("failed to create pin file in directory: %w", err)
>>>>>>> tmp
}
return f.Close()
}
@ -569,11 +531,7 @@ func (m *Manager) upgradeExtension(ext Extension, force bool) error {
if ext.isLocal {
return localExtensionUpgradeError
}
<<<<<<< HEAD
if ext.pin != "" {
=======
if ext.IsPinned() {
>>>>>>> tmp
return pinnedExtensionUpgradeError
}
if !ext.UpdateAvailable() {