[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/git-commit a7fe5da977 1/5: magit-list-worktrees: Change or
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/git-commit a7fe5da977 1/5: magit-list-worktrees: Change order in returned list |
Date: |
Tue, 25 Apr 2023 17:01:26 -0400 (EDT) |
branch: elpa/git-commit
commit a7fe5da977525b3347d4af8d89fd80c4eb8612dc
Author: Jonas Bernoulli <jonas@bernoul.li>
Commit: Jonas Bernoulli <jonas@bernoul.li>
magit-list-worktrees: Change order in returned list
This prepares for the next commit, which will append additional
elements.
There are no third-party packages on the Emacsmirror, which use
this function.
---
lisp/magit-git.el | 13 ++++++++-----
lisp/magit-worktree.el | 2 +-
2 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/lisp/magit-git.el b/lisp/magit-git.el
index fbcd48dbf3..7c404820dd 100644
--- a/lisp/magit-git.el
+++ b/lisp/magit-git.el
@@ -2114,6 +2114,8 @@ PATH has to be relative to the super-repository."
(magit-git-string "submodule--helper" "name" path)))
(defun magit-list-worktrees ()
+ "Return list of the worktrees of this repository.
+The returned list has the form (PATH COMMIT BRANCH BARE)."
(let ((remote (file-remote-p default-directory))
worktrees worktree)
(dolist (line (let ((magit-git-global-arguments
@@ -2134,6 +2136,10 @@ PATH has to be relative to the super-repository."
(setq path (or (magit-toplevel path) path))
(setq worktree (list path nil nil nil))
(push worktree worktrees)))
+ ((string-prefix-p "HEAD" line)
+ (setf (nth 1 worktree) (substring line 5)))
+ ((string-prefix-p "branch" line)
+ (setf (nth 2 worktree) (substring line 18)))
((string-equal line "bare")
(let* ((default-directory (car worktree))
(wt (and (not (magit-get-boolean "core.bare"))
@@ -2142,11 +2148,8 @@ PATH has to be relative to the super-repository."
(progn (setf (nth 0 worktree) (expand-file-name wt))
(setf (nth 2 worktree) (magit-rev-parse "HEAD"))
(setf (nth 3 worktree) (magit-get-current-branch)))
- (setf (nth 1 worktree) t))))
- ((string-prefix-p "HEAD" line)
- (setf (nth 2 worktree) (substring line 5)))
- ((string-prefix-p "branch" line)
- (setf (nth 3 worktree) (substring line 18)))))
+ (setf (nth 3 worktree) t))))
+ ))
(nreverse worktrees)))
(defun magit-symbolic-ref-p (name)
diff --git a/lisp/magit-worktree.el b/lisp/magit-worktree.el
index 135e821580..ca2618811a 100644
--- a/lisp/magit-worktree.el
+++ b/lisp/magit-worktree.el
@@ -163,7 +163,7 @@ If there is only one worktree, then insert nothing."
(magit-insert-heading "Worktrees:")
(let* ((cols
(mapcar
- (pcase-lambda (`(,path ,barep ,commit ,branch))
+ (pcase-lambda (`(,path ,commit ,branch ,barep))
(cons (cond
(branch (propertize
branch 'font-lock-face