update packages and add valign

This commit is contained in:
2026-04-05 20:00:27 +02:00
parent b062fb98e3
commit 03fb00e374
640 changed files with 109768 additions and 39311 deletions

View File

@@ -1,6 +1,6 @@
;;; magit-worktree.el --- Worktree support -*- lexical-binding:t -*-
;; Copyright (C) 2008-2025 The Magit Project Contributors
;; Copyright (C) 2008-2026 The Magit Project Contributors
;; Author: Jonas Bernoulli <emacs.magit@jonas.bernoulli.dev>
;; Maintainer: Jonas Bernoulli <emacs.magit@jonas.bernoulli.dev>
@@ -143,11 +143,11 @@ just \"PREFIX_\". Always forward PROMPT as-is."
COMMIT may, but does not have to be, a local branch.
Interactively, use `magit-read-worktree-directory-function'."
(interactive
(let ((commit (magit-read-branch-or-commit
"In new worktree; checkout" nil
(mapcar #'caddr (magit-list-worktrees)))))
(list (magit--read-worktree-directory commit (magit-local-branch-p commit))
commit)))
(let ((commit (magit-read-branch-or-commit
"In new worktree; checkout" nil
(mapcar #'caddr (magit-list-worktrees)))))
(list (magit--read-worktree-directory commit (magit-local-branch-p commit))
commit)))
(when (zerop (magit-run-git "worktree" "add"
(magit--expand-worktree directory) commit))
(magit-diff-visit-directory directory)))
@@ -157,11 +157,11 @@ Interactively, use `magit-read-worktree-directory-function'."
"Create a new BRANCH and check it out in a new worktree at DIRECTORY.
Interactively, use `magit-read-worktree-directory-function'."
(interactive
(pcase-let
((`(,branch ,start-point)
(magit-branch-read-args "In new worktree; checkout new branch")))
(list (magit--read-worktree-directory branch t)
branch start-point)))
(pcase-let
((`(,branch ,start-point)
(magit-branch-read-args "In new worktree; checkout new branch")))
(list (magit--read-worktree-directory branch t)
branch start-point)))
(when (zerop (magit-run-git "worktree" "add" "-b" branch
(magit--expand-worktree directory) start-point))
(magit-diff-visit-directory directory)))
@@ -170,11 +170,11 @@ Interactively, use `magit-read-worktree-directory-function'."
(defun magit-worktree-move (worktree directory)
"Move existing WORKTREE directory to DIRECTORY."
(interactive
(list (magit-completing-read "Move worktree"
(cdr (magit-list-worktrees))
nil t nil nil
(magit-section-value-if 'worktree))
(read-directory-name "Move worktree to: ")))
(list (magit-completing-read "Move worktree"
(cdr (magit-list-worktrees))
nil t nil nil
(magit-section-value-if 'worktree))
(read-directory-name "Move worktree to: ")))
(if (file-directory-p (expand-file-name ".git" worktree))
(user-error "You may not move the main working tree")
(let ((preexisting-directory (file-directory-p directory)))
@@ -194,18 +194,31 @@ Interactively, use `magit-read-worktree-directory-function'."
"Delete a worktree, defaulting to the worktree at point.
The primary worktree cannot be deleted."
(interactive
(list (magit-completing-read "Delete worktree"
(mapcar #'car (cdr (magit-list-worktrees)))
nil t nil nil
(magit-section-value-if 'worktree))))
(list (magit-completing-read "Delete worktree"
(mapcar #'car (cdr (magit-list-worktrees)))
nil t nil nil
(magit-section-value-if 'worktree))))
(if (file-directory-p (expand-file-name ".git" worktree))
(user-error "Deleting %s would delete the shared .git directory" worktree)
(let ((primary (file-name-as-directory (caar (magit-list-worktrees)))))
(magit-confirm-files (if magit-delete-by-moving-to-trash 'trash 'delete)
(list worktree))
(when (file-exists-p worktree)
(let ((delete-by-moving-to-trash magit-delete-by-moving-to-trash))
(delete-directory worktree t magit-delete-by-moving-to-trash)))
(let (uncommitted)
(magit-confirm
(cond ((let ((default-directory worktree))
(or (magit-anything-modified-p)
(magit-untracked-files)))
(setq uncommitted 'danger))
(magit-delete-by-moving-to-trash 'trash)
('delete))
(format "%s worktree \"%s\"%s"
(if magit-delete-by-moving-to-trash "Trash" "Delete")
(file-name-nondirectory (directory-file-name worktree))
(if uncommitted " despite uncommitted changes" ""))
nil nil (list worktree)))
(if magit-delete-by-moving-to-trash
(let ((delete-by-moving-to-trash t))
(delete-directory worktree t t))
(magit-call-git "worktree" "remove" "--force" worktree)))
(if (file-exists-p default-directory)
(magit-run-git "worktree" "prune")
(let ((default-directory primary))
@@ -221,13 +234,13 @@ minibuffer. If the worktree at point is the one whose
status is already being displayed in the current buffer,
then show it in Dired instead."
(interactive
(list (or (magit-section-value-if 'worktree)
(magit-completing-read
"Show status for worktree"
(cl-delete (directory-file-name (magit-toplevel))
(magit-list-worktrees)
:test #'equal :key #'car)
nil t))))
(list (or (magit-section-value-if 'worktree)
(magit-completing-read
"Show status for worktree"
(cl-delete (directory-file-name (magit-toplevel))
(magit-list-worktrees)
:test #'equal :key #'car)
nil t))))
(magit-diff-visit-directory worktree))
(defun magit--expand-worktree (directory)
@@ -254,18 +267,21 @@ If there is only one worktree, then insert nothing."
(let* ((cols
(mapcar
(lambda (config)
(pcase-let ((`(,_ ,commit ,branch ,bare) config))
(pcase-let ((`(,directory ,commit ,branch ,bare) config))
(cons (cond
(branch
(propertize
branch 'font-lock-face
(if (equal branch (magit-get-current-branch))
'magit-branch-current
'magit-branch-local)))
(commit
(propertize (magit-rev-abbrev commit)
'font-lock-face 'magit-hash))
(bare "(bare)"))
(branch
(propertize
branch 'font-lock-face
(if (equal branch (magit-get-current-branch))
'magit-branch-current
'magit-branch-local)))
(commit
(propertize
(magit-rev-abbrev commit) 'font-lock-face
(if (file-equal-p default-directory directory)
'(magit-hash magit-branch-current)
'magit-hash)))
(bare "(bare)"))
config)))
worktrees))
(align (1+ (apply #'max (mapcar (##string-width (car %)) cols)))))
@@ -300,6 +316,7 @@ with padding for alignment."
;; ("and>" . "cond-let--and>")
;; ("and-let" . "cond-let--and-let")
;; ("if-let" . "cond-let--if-let")
;; ("when$" . "cond-let--when$")
;; ("when-let" . "cond-let--when-let")
;; ("while-let" . "cond-let--while-let")
;; ("match-string" . "match-string")