emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] elpa-admin 6470f5dc33: * elpa-admin.el (elpaa--pull): Don't updat


From: Jonas Bernoulli
Subject: [elpa] elpa-admin 6470f5dc33: * elpa-admin.el (elpaa--pull): Don't update if upstream is missing
Date: Mon, 10 Jan 2022 13:40:48 -0500 (EST)

branch: elpa-admin
commit 6470f5dc335d817dfba1f02a1b3862b06bc3463b
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.
    
    Second attempt after faulty 7c525ccba1f7f380f46bcc364c78d4e6bf831652.
---
 elpa-admin.el | 39 ++++++++++++++++++++++-----------------
 1 file changed, 22 insertions(+), 17 deletions(-)

diff --git a/elpa-admin.el b/elpa-admin.el
index 004777eeac..363919d9ab 100644
--- a/elpa-admin.el
+++ b/elpa-admin.el
@@ -1591,23 +1591,28 @@ arbitrary code."
                  (buffer-string))))
           (if (string-match (regexp-quote "\n# branch.ab +0 -0") status)
               (elpaa--message "%s up-to-date" dirname)
-            ;; Set upstream if applicable.
-            (when (and
-                   ;; Upstream not set yet!
-                   (not (string-match "\n# branch.upstream" status))
-                   ;; This is one of the "elpa-managed" branches.
-                   (string-match
-                    (concat "\n# branch.head \\("
-                            (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"))))
+            (let* ((br (and (string-match
+                             (concat "\n# branch.head \\("
+                                     (regexp-quote elpaa--branch-prefix)
+                                     ".*\\)")
+                             status)
+                            (match-string 1 status)))
+                   (ortb (and br (concat "refs/remotes/origin/" br))))
+              ;; Set upstream if applicable.
+              (when (and
+                     ;; Upstream not set yet!
+                     (not (string-match "\n# branch.upstream" status))
+                     ;; This is one of the "elpa-managed" branches.
+                     br
+                     ;; There is an upstream to set it to!
+                     (elpaa--git-branch-p ortb))
+                (elpaa--call t "git" "branch" "--set-upstream-to" ortb))
+              (if (or (not ortb)    ;Not a worktree, presumably.
+                      (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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]