"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "pkg/cmd/extensions/manager.go" between
gh-cli-1.12.1.tar.gz and gh-cli-1.13.1.tar.gz

About: GitHub CLI is GitHub’s official command line tool.

manager.go  (gh-cli-1.12.1):manager.go  (gh-cli-1.13.1)
skipping to change at line 139 skipping to change at line 139
name := strings.TrimSuffix(path.Base(cloneURL), ".git") name := strings.TrimSuffix(path.Base(cloneURL), ".git")
targetDir := filepath.Join(m.installDir(), name) targetDir := filepath.Join(m.installDir(), name)
externalCmd := m.newCommand(exe, "clone", cloneURL, targetDir) externalCmd := m.newCommand(exe, "clone", cloneURL, targetDir)
externalCmd.Stdout = stdout externalCmd.Stdout = stdout
externalCmd.Stderr = stderr externalCmd.Stderr = stderr
return externalCmd.Run() return externalCmd.Run()
} }
var localExtensionUpgradeError = errors.New("local extensions can not be upgrade
d")
func (m *Manager) Upgrade(name string, stdout, stderr io.Writer) error { func (m *Manager) Upgrade(name string, stdout, stderr io.Writer) error {
exe, err := m.lookPath("git") exe, err := m.lookPath("git")
if err != nil { if err != nil {
return err return err
} }
exts := m.List() exts := m.List()
if len(exts) == 0 { if len(exts) == 0 {
return errors.New("no extensions installed") return errors.New("no extensions installed")
} }
someUpgraded := false someUpgraded := false
for _, f := range exts { for _, f := range exts {
if name == "" { if name == "" {
fmt.Fprintf(stdout, "[%s]: ", f.Name()) fmt.Fprintf(stdout, "[%s]: ", f.Name())
} else if f.Name() != name { } else if f.Name() != name {
continue continue
} }
if f.IsLocal() {
if name == "" {
fmt.Fprintf(stdout, "%s\n", localExtensionUpgrade
Error)
} else {
err = localExtensionUpgradeError
}
continue
}
dir := filepath.Dir(f.Path()) dir := filepath.Dir(f.Path())
externalCmd := m.newCommand(exe, "-C", dir, "--git-dir="+filepath .Join(dir, ".git"), "pull", "--ff-only") externalCmd := m.newCommand(exe, "-C", dir, "--git-dir="+filepath .Join(dir, ".git"), "pull", "--ff-only")
externalCmd.Stdout = stdout externalCmd.Stdout = stdout
externalCmd.Stderr = stderr externalCmd.Stderr = stderr
if e := externalCmd.Run(); e != nil { if e := externalCmd.Run(); e != nil {
err = e err = e
} }
someUpgraded = true someUpgraded = true
} }
if err == nil && !someUpgraded { if err == nil && !someUpgraded {
 End of changes. 2 change blocks. 
0 lines changed or deleted 14 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)