update packages

This commit is contained in:
2025-02-26 20:16:44 +01:00
parent 59db017445
commit 45d49daef0
291 changed files with 16240 additions and 522600 deletions

View File

@@ -1,9 +1,9 @@
;;; magit-status.el --- The grand overview -*- lexical-binding:t -*-
;; Copyright (C) 2008-2023 The Magit Project Contributors
;; Copyright (C) 2008-2025 The Magit Project Contributors
;; Author: Jonas Bernoulli <jonas@bernoul.li>
;; Maintainer: Jonas Bernoulli <jonas@bernoul.li>
;; Author: Jonas Bernoulli <emacs.magit@jonas.bernoulli.dev>
;; Maintainer: Jonas Bernoulli <emacs.magit@jonas.bernoulli.dev>
;; SPDX-License-Identifier: GPL-3.0-or-later
@@ -41,12 +41,12 @@
:type 'hook)
(defcustom magit-status-headers-hook
'(magit-insert-error-header
magit-insert-diff-filter-header
magit-insert-head-branch-header
magit-insert-upstream-branch-header
magit-insert-push-branch-header
magit-insert-tags-header)
(list #'magit-insert-error-header
#'magit-insert-diff-filter-header
#'magit-insert-head-branch-header
#'magit-insert-upstream-branch-header
#'magit-insert-push-branch-header
#'magit-insert-tags-header)
"Hook run to insert headers into the status buffer.
This hook is run by `magit-insert-status-headers', which in turn
@@ -55,32 +55,32 @@ all."
:package-version '(magit . "2.1.0")
:group 'magit-status
:type 'hook
:options '(magit-insert-error-header
magit-insert-diff-filter-header
magit-insert-repo-header
magit-insert-remote-header
magit-insert-head-branch-header
magit-insert-upstream-branch-header
magit-insert-push-branch-header
magit-insert-tags-header))
:options (list #'magit-insert-error-header
#'magit-insert-diff-filter-header
#'magit-insert-repo-header
#'magit-insert-remote-header
#'magit-insert-head-branch-header
#'magit-insert-upstream-branch-header
#'magit-insert-push-branch-header
#'magit-insert-tags-header))
(defcustom magit-status-sections-hook
'(magit-insert-status-headers
magit-insert-merge-log
magit-insert-rebase-sequence
magit-insert-am-sequence
magit-insert-sequencer-sequence
magit-insert-bisect-output
magit-insert-bisect-rest
magit-insert-bisect-log
magit-insert-untracked-files
magit-insert-unstaged-changes
magit-insert-staged-changes
magit-insert-stashes
magit-insert-unpushed-to-pushremote
magit-insert-unpushed-to-upstream-or-recent
magit-insert-unpulled-from-pushremote
magit-insert-unpulled-from-upstream)
(list #'magit-insert-status-headers
#'magit-insert-merge-log
#'magit-insert-rebase-sequence
#'magit-insert-am-sequence
#'magit-insert-sequencer-sequence
#'magit-insert-bisect-output
#'magit-insert-bisect-rest
#'magit-insert-bisect-log
#'magit-insert-untracked-files
#'magit-insert-unstaged-changes
#'magit-insert-staged-changes
#'magit-insert-stashes
#'magit-insert-unpushed-to-pushremote
#'magit-insert-unpushed-to-upstream-or-recent
#'magit-insert-unpulled-from-pushremote
#'magit-insert-unpulled-from-upstream)
"Hook run to insert sections into a status buffer."
:package-version '(magit . "2.12.0")
:group 'magit-status
@@ -142,6 +142,49 @@ The functions which respect this option are
:group 'magit-status
:type 'boolean)
(defcustom magit-status-show-untracked-files t
"Whether to list untracked files in the status buffer.
- If nil, do not list any untracked files.
- If t, list untracked files, but if a directory does not contain any
untracked files, then only list that directory, not the contained
untracked files.
- If all, then list each individual untracked files. This is can be
very slow and is discouraged.
The corresponding values for the Git variable are \"no\", \"normal\"
and \"all\".
To disable listing untracked files in a specific repository only, add
the following to \".dir-locals.el\":
((magit-status-mode
(magit-status-show-untracked-files . \"no\")))
Alternatively (and mostly for historic reasons), it is possible to use
`git-config' to set the repository-local value:
git config set --local status.showUntrackedFiles no
This does *not* override the (if any) local value of this Lisp variable,
but it does override its global value.
See the last section in the git-status(1) manpage, to speed up the part
of the work Git is responsible for. Turning that list into sections is
also not free, so Magit only lists `magit-status-file-list-limit' files."
:package-version '(magit . "4.3.0")
:group 'magit-status
:type 'boolean
:safe 'booleanp)
(defcustom magit-status-file-list-limit 100
"How many files to list in file list sections in the status buffer.
For performance reasons, it is recommended that you do not
increase this limit."
:package-version '(magit . "4.3.0")
:group 'magit-status
:type 'natnum)
(defcustom magit-status-margin
(list nil
(nth 1 magit-log-margin)
@@ -342,38 +385,22 @@ init file: (global-set-key (kbd \"C-x g\") \\='magit-status-quick)."
(transient-define-prefix magit-status-jump ()
"In a Magit-Status buffer, jump to a section."
["Jump to"
[("z " "Stashes" magit-jump-to-stashes
:if (lambda () (memq 'magit-insert-stashes magit-status-sections-hook)))
("t " "Tracked" magit-jump-to-tracked
:if (lambda () (memq 'magit-insert-tracked-files magit-status-sections-hook)))
("n " "Untracked" magit-jump-to-untracked
:if (lambda () (memq 'magit-insert-untracked-files magit-status-sections-hook)))
("u " "Unstaged" magit-jump-to-unstaged
:if (lambda () (memq 'magit-insert-unstaged-changes magit-status-sections-hook)))
("s " "Staged" magit-jump-to-staged
:if (lambda () (memq 'magit-insert-staged-changes magit-status-sections-hook)))]
[("fu" "Unpulled from upstream" magit-jump-to-unpulled-from-upstream
:if (lambda () (memq 'magit-insert-unpulled-from-upstream magit-status-sections-hook)))
("fp" "Unpulled from pushremote" magit-jump-to-unpulled-from-pushremote
:if (lambda () (memq 'magit-insert-unpulled-from-pushremote magit-status-sections-hook)))
("pu" magit-jump-to-unpushed-to-upstream
:if (lambda ()
(or (memq 'magit-insert-unpushed-to-upstream-or-recent magit-status-sections-hook)
(memq 'magit-insert-unpushed-to-upstream magit-status-sections-hook)))
:description (lambda ()
(let ((upstream (magit-get-upstream-branch)))
(if (or (not upstream)
(magit-rev-ancestor-p "HEAD" upstream))
"Recent commits"
"Unmerged into upstream"))))
("pp" "Unpushed to pushremote" magit-jump-to-unpushed-to-pushremote
:if (lambda () (memq 'magit-insert-unpushed-to-pushremote magit-status-sections-hook)))
("a " "Assumed unstaged" magit-jump-to-assume-unchanged
:if (lambda () (memq 'magit-insert-assume-unchanged-files magit-status-sections-hook)))
("w " "Skip worktree" magit-jump-to-skip-worktree
:if (lambda () (memq 'magit-insert-skip-worktree-files magit-status-sections-hook)))]
[("i" "Using Imenu" imenu)]])
[["Jump to"
("z " magit-jump-to-stashes)
("t " magit-jump-to-tracked)
("n " magit-jump-to-untracked)
("i " magit-jump-to-ignored)
("u " magit-jump-to-unstaged)
("s " magit-jump-to-staged)]
[""
("fu" magit-jump-to-unpulled-from-upstream)
("fp" magit-jump-to-unpulled-from-pushremote)
("pu" magit-jump-to-unpushed-to-upstream)
("pp" magit-jump-to-unpushed-to-pushremote)
("a " magit-jump-to-assume-unchanged)
("w " magit-jump-to-skip-worktree)]
["Jump using"
("j" "Imenu" imenu)]])
(define-derived-mode magit-status-mode magit-mode "Magit"
"Mode for looking at Git status.
@@ -401,10 +428,11 @@ Staging and applying changes is documented in info node
Type \\[magit-commit] to create a commit.
\\{magit-status-mode-map}"
:interactive nil
:group 'magit-status
(hack-dir-local-variables-non-file-buffer)
(magit-hack-dir-local-variables)
(when magit-status-initial-section
(add-hook 'magit-refresh-buffer-hook
(add-hook 'magit-post-create-buffer-hook
#'magit-status-goto-initial-section nil t))
(setq magit--imenu-group-types '(not branch commit)))
@@ -426,8 +454,8 @@ Type \\[magit-commit] to create a commit.
magit-status-use-buffer-arguments))
(file (and magit-status-goto-file-position
(magit-file-relative-name)))
(line (and file (line-number-at-pos)))
(col (and file (current-column)))
(line (and file (save-restriction (widen) (line-number-at-pos))))
(col (and file (save-restriction (widen) (current-column))))
(buf (magit-setup-buffer #'magit-status-mode nil
(magit-buffer-diff-args (nth 0 d))
(magit-buffer-diff-files (nth 1 d))
@@ -454,20 +482,19 @@ Type \\[magit-commit] to create a commit.
(defun magit-status-goto-initial-section ()
"Jump to the section specified by `magit-status-initial-section'."
(when-let ((section
(--some (if (integerp it)
(nth (1- it)
(magit-section-siblings (magit-current-section)
'next))
(magit-get-section it))
magit-status-initial-section)))
(seq-some (lambda (initial)
(if (integerp initial)
(nth (1- initial)
(magit-section-siblings
(magit-current-section) 'next))
(magit-get-section initial)))
magit-status-initial-section)))
(goto-char (oref section start))
(when-let ((vis (cdr (assq 'magit-status-initial-section
magit-section-initial-visibility-alist))))
(if (eq vis 'hide)
(magit-section-hide section)
(magit-section-show section))))
(remove-hook 'magit-refresh-buffer-hook
#'magit-status-goto-initial-section t))
(magit-section-show section)))))
(defun magit-status-maybe-update-revision-buffer (&optional _)
"When moving in the status buffer, update the revision buffer.
@@ -532,7 +559,7 @@ the status buffer causes this section to disappear again."
(when magit-buffer-diff-files
(insert " -- ")))
(when magit-buffer-diff-files
(insert (mapconcat #'identity magit-buffer-diff-files " ")))
(insert (string-join magit-buffer-diff-files " ")))
(insert ?\n))))
;;;; Reference Headers
@@ -554,13 +581,13 @@ instead. The optional BRANCH argument is for internal use only."
(insert (propertize commit 'font-lock-face 'magit-hash) ?\s))
(insert (propertize branch 'font-lock-face 'magit-branch-local))
(insert ?\s)
(insert (funcall magit-log-format-message-function branch summary))
(insert (magit-log--wash-summary summary))
(insert ?\n))
(magit-insert-section (commit commit)
(insert (format "%-10s" "Head: "))
(insert (propertize commit 'font-lock-face 'magit-hash))
(insert ?\s)
(insert (funcall magit-log-format-message-function nil summary))
(insert (magit-log--wash-summary summary))
(insert ?\n))))))
(defun magit-insert-upstream-branch-header (&optional branch upstream keyword)
@@ -587,10 +614,9 @@ arguments are for internal use only."
'font-lock-face 'magit-hash)
" "))
upstream " "
(funcall magit-log-format-message-function upstream
(funcall magit-log-format-message-function nil
(or (magit-rev-format "%s" upstream)
"(no commit message)"))))
(magit-log--wash-summary
(or (magit-rev-format "%s" upstream)
"(no commit message)")))
(cond
((magit--unnamed-upstream-p remote merge)
(concat (propertize merge 'font-lock-face 'magit-branch-remote)
@@ -626,10 +652,8 @@ arguments are for internal use only."
'font-lock-face 'magit-hash)
" "))
target " "
(funcall magit-log-format-message-function target
(funcall magit-log-format-message-function nil
(or (magit-rev-format "%s" target)
"(no commit message)"))))
(magit-log--wash-summary (or (magit-rev-format "%s" target)
"(no commit message)")))
(let ((remote (magit-get-push-remote branch)))
(if (magit-remote-p remote)
(concat target " "
@@ -706,116 +730,98 @@ remote in alphabetic order."
"<2>" (magit-menu-item "Discard files" #'magit-discard)
"<1>" (magit-menu-item "Stage files" #'magit-stage))
(magit-define-section-jumper magit-jump-to-untracked "Untracked files" untracked)
(magit-define-section-jumper magit-jump-to-untracked
"Untracked files" untracked nil magit-insert-untracked-files)
(magit-define-section-jumper magit-jump-to-tracked
"Tracked files" tracked nil magit-insert-tracked-files)
(magit-define-section-jumper magit-jump-to-ignored
"Ignored files" ignored nil magit-insert-ignored-files)
(magit-define-section-jumper magit-jump-to-skip-worktree
"Skip-worktree files" skip-worktree nil magit-insert-skip-worktree-files)
(magit-define-section-jumper magit-jump-to-assume-unchanged
"Assume-unchanged files" assume-unchanged nil
magit-insert-assume-unchanged-files)
(defun magit-insert-untracked-files ()
"Maybe insert a list or tree of untracked files.
"Maybe insert list of untracked files.
Do so depending on the value of `status.showUntrackedFiles'.
Note that even if the value is `all', Magit still initially
only shows directories. But the directory sections can then
be expanded using \"TAB\".
If the first element of `magit-buffer-diff-files' is a
directory, then limit the list to files below that. The value
value of that variable can be set using \"D -- DIRECTORY RET g\"."
(let* ((show (or (magit-get "status.showUntrackedFiles") "normal"))
(base (car magit-buffer-diff-files))
(base (and base (file-directory-p base) base)))
(unless (equal show "no")
(if (equal show "all")
(when-let ((files (magit-untracked-files nil base)))
(magit-insert-section (untracked)
(magit-insert-heading "Untracked files:")
(magit-insert-files files base)
(insert ?\n)))
(when-let ((files
(--mapcat (and (eq (aref it 0) ??)
(list (substring it 3)))
(magit-git-items "status" "-z" "--porcelain"
(magit-ignore-submodules-p t)
"--" base))))
(magit-insert-section (untracked)
(magit-insert-heading "Untracked files:")
(dolist (file files)
(magit-insert-section (file file)
(insert (propertize file 'font-lock-face 'magit-filename) ?\n)))
(insert ?\n)))))))
(magit-define-section-jumper magit-jump-to-tracked "Tracked files" tracked)
List files if `magit-status-show-untracked-files' is non-nil, but also
take the local value of Git variable `status.showUntrackedFiles' into
account. The local value of the Lisp variable takes precedence over the
local value of the Git variable. The global value of the Git variable
is always ignored."
(when-let*
((value (or (and (local-variable-p 'magit-status-show-untracked-files)
magit-status-show-untracked-files)
(pcase (magit-get "--local" "status.showUntrackedFiles")
((or "no" "off" "false" "0") 'no)
((or "yes" "on" "true" "1") t)
("all" 'all))
magit-status-show-untracked-files))
((not (eq value 'no))))
(magit-insert-files
'untracked
(lambda (files)
(mapcan (lambda (line)
(and (eq (aref line 0) ??)
(list (substring line 3))))
(apply #'magit-git-items "status" "-z" "--porcelain"
(format "--untracked-files=%s"
(if (eq value 'all) "all" "normal"))
"--" files))))))
(defun magit-insert-tracked-files ()
"Insert a tree of tracked files.
If the first element of `magit-buffer-diff-files' is a
directory, then limit the list to files below that. The value
value of that variable can be set using \"D -- DIRECTORY RET g\"."
(when-let ((files (magit-list-files)))
(let* ((base (car magit-buffer-diff-files))
(base (and base (file-directory-p base) base)))
(magit-insert-section (tracked nil t)
(magit-insert-heading "Tracked files:")
(magit-insert-files files base)
(insert ?\n)))))
"Insert a list of tracked files.
Honor the buffer's file filter, which can be set using \"D - -\"."
(magit-insert-files 'tracked #'magit-list-files))
(defun magit-insert-ignored-files ()
"Insert a tree of ignored files.
If the first element of `magit-buffer-diff-files' is a
directory, then limit the list to files below that. The value
of that variable can be set using \"D -- DIRECTORY RET g\"."
(when-let ((files (magit-ignored-files)))
(let* ((base (car magit-buffer-diff-files))
(base (and base (file-directory-p base) base)))
(magit-insert-section (tracked nil t)
(magit-insert-heading "Ignored files:")
(magit-insert-files files base)
(insert ?\n)))))
(magit-define-section-jumper magit-jump-to-skip-worktree "Skip-worktree files" skip-worktree)
"Insert a list of ignored files.
Honor the buffer's file filter, which can be set using \"D - -\"."
(magit-insert-files 'ignored
(lambda (args) (magit-ignored-files "--directory" args))))
(defun magit-insert-skip-worktree-files ()
"Insert a tree of skip-worktree files.
If the first element of `magit-buffer-diff-files' is a
directory, then limit the list to files below that. The value
of that variable can be set using \"D -- DIRECTORY RET g\"."
(when-let ((files (magit-skip-worktree-files)))
(let* ((base (car magit-buffer-diff-files))
(base (and base (file-directory-p base) base)))
(magit-insert-section (skip-worktree nil t)
(magit-insert-heading "Skip-worktree files:")
(magit-insert-files files base)
(insert ?\n)))))
(magit-define-section-jumper magit-jump-to-assume-unchanged "Assume-unchanged files" assume-unchanged)
"Insert a list of skip-worktree files.
Honor the buffer's file filter, which can be set using \"D - -\"."
(magit-insert-files 'skip-worktree #'magit-skip-worktree-files))
(defun magit-insert-assume-unchanged-files ()
"Insert a tree of files that are assumed to be unchanged.
"Insert a list of files that are assumed to be unchanged.
Honor the buffer's file filter, which can be set using \"D - -\"."
(magit-insert-files 'assume-unchanged #'magit-assume-unchanged-files))
If the first element of `magit-buffer-diff-files' is a
directory, then limit the list to files below that. The value
of that variable can be set using \"D -- DIRECTORY RET g\"."
(when-let ((files (magit-assume-unchanged-files)))
(let* ((base (car magit-buffer-diff-files))
(base (and base (file-directory-p base) base)))
(magit-insert-section (assume-unchanged nil t)
(magit-insert-heading "Assume-unchanged files:")
(magit-insert-files files base)
(insert ?\n)))))
(defun magit-insert-files (files directory)
(while (and files (string-prefix-p (or directory "") (car files)))
(let ((dir (file-name-directory (car files))))
(if (equal dir directory)
(let ((file (pop files)))
(magit-insert-section (file file)
(insert (propertize file 'font-lock-face 'magit-filename) ?\n)))
(magit-insert-section (file dir t)
(insert (propertize dir 'file 'magit-filename) ?\n)
(magit-insert-heading)
(setq files (magit-insert-files files dir))))))
files)
(defun magit-insert-files (type fn)
(when-let ((files (funcall fn
(and magit-buffer-diff-files
(cons "--" magit-buffer-diff-files)))))
(magit-insert-section section ((eval type) nil t)
(magit-insert-heading (length files)
(let ((title (symbol-name type)))
(format "%c%s files"
(capitalize (aref title 0))
(substring title 1))))
(magit-insert-section-body
(let ((magit-section-insert-in-reverse t)
(limit magit-status-file-list-limit))
(while (and files (> limit 0))
(cl-decf limit)
(let ((file (pop files)))
(magit-insert-section (file file)
(insert (funcall magit-format-file-function
'list file 'magit-filename))
(insert ?\n))))
(when files
(magit-insert-section (info)
(insert (propertize
(format "%s files not listed\n" (length files))
'face 'warning)))))
(insert ?\n)
(oset section children (nreverse (oref section children)))))))
;;; _
(provide 'magit-status)