Fix various errors in 'doom upgrade'

This commit is contained in:
Henrik Lissner 2019-07-29 03:34:35 +02:00
parent 2304d69898
commit 8a16513107
No known key found for this signature in database
GPG Key ID: 5F6C0EA160557395

View File

@ -47,7 +47,7 @@ following shell commands:
process-file-side-effects)
(print! (start "Preparing to upgrade Doom Emacs and its packages..."))
(let* ((branch (cdr (doom--sh "git" "symbolic-ref" "HEAD")))
(let* ((branch (vc-git--symbolic-ref doom-emacs-dir))
(target-remote (format "%s/%s" doom-repo-remote branch)))
(unless branch
(error! (if (file-exists-p! ".git" doom-emacs-dir)
@ -72,9 +72,15 @@ following shell commands:
(let ((this-rev (vc-git--rev-parse "HEAD"))
(new-rev (vc-git--rev-parse target-remote)))
(if (equal this-rev new-rev)
(print! (success "Doom is already up-to-date!"))
(print! (info "Updates are available!\n\n Old revision: %s (%s)\n\n New revision: %s (%s)\n\n"
(cond
((and (null this-rev)
(null new-rev))
(error "Failed to get revisions for %s" target-remote))
((equal this-rev new-rev)
(print! (success "Doom is already up-to-date!")))
((print! (info "Updates are available!\n\n Old revision: %s (%s)\n\n New revision: %s (%s)\n\n"
(substring this-rev 0 10)
(cdr (doom--sh "git" "log" "-1" "--format=%cr" "HEAD"))
(substring new-rev 0 10)
@ -98,4 +104,4 @@ following shell commands:
(doom-cli-refresh)
(when (doom-packages-update doom-auto-accept)
(doom-reload-package-autoloads 'force-p))
(print! (success "Done! Restart Emacs for changes to take effect."))))))))
(print! (success "Done! Restart Emacs for changes to take effect.")))))))))