[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] scratch/elpa-admin_fixes 7c525cc 3/4: * elpa-admin.el (elpaa--pul
From: |
Jonas Bernoulli |
Subject: |
[elpa] scratch/elpa-admin_fixes 7c525cc 3/4: * elpa-admin.el (elpaa--pull): Don't update if upstream is missing |
Date: |
Thu, 21 Oct 2021 16:06:27 -0400 (EDT) |
branch: scratch/elpa-admin_fixes
commit 7c525ccba1f7f380f46bcc364c78d4e6bf831652
Author: Jonas Bernoulli <jonas@bernoul.li>
Commit: Jonas Bernoulli <jonas@bernoul.li>
* elpa-admin.el (elpaa--pull): Don't update if upstream is missing
After a new package has been added locally but before pushing it to
"origin", the user may run "make build/<pkgname>" more than once.
Starting with the second run this tried to merge from the respective
branch on "origin" but since that doesn't exist yet, that failed.
---
elpa-admin.el | 27 +++++++++++++++------------
1 file changed, 15 insertions(+), 12 deletions(-)
diff --git a/elpa-admin.el b/elpa-admin.el
index b13c5b0..9618702 100644
--- a/elpa-admin.el
+++ b/elpa-admin.el
@@ -1528,11 +1528,13 @@ arbitrary code."
(message "Running git pull in %S" default-directory)
(elpaa--call t "git" "pull"))
((file-exists-p ".git") ;A worktree, presumably.
- (let ((status
- (with-temp-buffer
- (let ((elpaa--debug nil))
- (elpaa--call t "git" "status" "--branch" "--porcelain=2"))
- (buffer-string))))
+ (let* ((status
+ (with-temp-buffer
+ (let ((elpaa--debug nil))
+ (elpaa--call t "git" "status" "--branch" "--porcelain=2"))
+ (buffer-string)))
+ (br (match-string 1 status))
+ (ortb (concat "refs/remotes/origin/" br)))
(if (string-match (regexp-quote "\n# branch.ab +0 -0") status)
(elpaa--message "%s up-to-date" dirname)
;; Set upstream if applicable.
@@ -1545,13 +1547,14 @@ arbitrary code."
(regexp-quote elpaa--branch-prefix)
".*\\)")
status))
- (let* ((br (match-string 1 status))
- (ortb (concat "refs/remotes/origin/" br)))
- ;; There is an upstream to set it to!
- (when (elpaa--git-branch-p ortb)
- (elpaa--call t "git" "branch" "--set-upstream-to" ortb))))
- (message "Updating worktree in %S" default-directory)
- (elpaa--call t "git" "merge"))))
+ ;; There is an upstream to set it to!
+ (when (elpaa--git-branch-p ortb)
+ (elpaa--call t "git" "branch" "--set-upstream-to" ortb)))
+ (if (elpaa--git-branch-p ortb)
+ (progn
+ (message "Updating worktree in %S" default-directory)
+ (elpaa--call t "git" "merge"))
+ (message "Not pushed to origin yet. Not updating worktree")))))
(t (error "No .git in %S" default-directory)))
(unless (and (eobp) (bobp))
(message "Updated %s:%s%s" dirname