[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] elpa-admin 7fa8f34: * elpa-admin.el (elpaa--pull): Don't set non-
From: |
Stefan Monnier |
Subject: |
[elpa] elpa-admin 7fa8f34: * elpa-admin.el (elpaa--pull): Don't set non-existing upstream |
Date: |
Sat, 26 Dec 2020 13:06:34 -0500 (EST) |
branch: elpa-admin
commit 7fa8f34da99203b6d6ffef72958a25bb09878021
Author: Stefan Monnier <monnier@iro.umontreal.ca>
Commit: Stefan Monnier <monnier@iro.umontreal.ca>
* elpa-admin.el (elpaa--pull): Don't set non-existing upstream
---
elpa-admin.el | 26 ++++++++++++++++----------
1 file changed, 16 insertions(+), 10 deletions(-)
diff --git a/elpa-admin.el b/elpa-admin.el
index e9b59d4..2e5d265 100644
--- a/elpa-admin.el
+++ b/elpa-admin.el
@@ -1025,22 +1025,28 @@ Rename DIR/ to PKG-VERS/, and return the descriptor."
(message "Running git pull in %S" default-directory)
(elpaa--call t "git" "pull"))
((file-exists-p ".git") ;A worktree, presumably.
- (let ((status
+ (let ((status
(with-temp-buffer
(let ((elpaa--debug nil))
(elpaa--call t "git" "status" "--branch" "--porcelain=2"))
(buffer-string))))
(if (string-match (regexp-quote "\n# branch.ab +0 -0") status)
(elpaa--message "%s up-to-date" dirname)
- (unless (or (string-match "\n# branch.upstream" status)
- (not (string-match
- (concat "\n# branch.head \\("
- (regexp-quote elpaa--branch-prefix)
- ".*\\)")
- status)))
- ;; No upstream set yet.
- (elpaa--call t "git" "branch" "--set-upstream-to"
- (concat "origin/" (match-string 1 status))))
+ ;; 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 "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"))))
(t (error "No .git in %S" default-directory)))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [elpa] elpa-admin 7fa8f34: * elpa-admin.el (elpaa--pull): Don't set non-existing upstream,
Stefan Monnier <=