update packages

This commit is contained in:
2025-06-22 17:08:08 +02:00
parent 54e5633369
commit 16a0a6db93
558 changed files with 68349 additions and 26568 deletions

View File

@@ -50,7 +50,7 @@
(declare-function magit-blame-mode "magit-blame" (&optional arg))
(defvar magit-blame-mode)
;; For `magit-diff-show-or-scroll'
(declare-function git-rebase-current-line "git-rebase" ())
(declare-function git-rebase-current-line "git-rebase" (&optional batch))
;; For `magit-diff-unmerged'
(declare-function magit-merge-in-progress-p "magit-merge" ())
(declare-function magit--merge-range "magit-merge" (&optional head))
@@ -73,7 +73,7 @@
(declare-function magit-commit-add-log "magit-commit" ())
(declare-function magit-diff-trace-definition "magit-log" ())
(declare-function magit-patch-save "magit-patch" (files &optional arg))
(declare-function magit-do-async-shell-command "magit-extras" (file))
(declare-function magit-do-async-shell-command "magit-dired" (file))
(declare-function magit-add-change-log-entry "magit-extras"
(&optional whoami file-name other-window))
(declare-function magit-add-change-log-entry-other-window "magit-extras"
@@ -141,9 +141,7 @@ to have any effect."
:type 'float)
(defcustom magit-diff-highlight-hunk-body t
"Whether to highlight bodies of selected hunk sections.
This only has an effect if `magit-diff-highlight' is a
member of `magit-section-highlight-hook', which see."
"Whether to highlight bodies of selected hunk sections."
:package-version '(magit . "2.1.0")
:group 'magit-diff
:type 'boolean)
@@ -194,13 +192,16 @@ keep their distinct foreground colors."
"Whether to show word-granularity differences within diff hunks.
`nil' Never show fine differences.
`t' Show fine differences for the current diff hunk only.
`all' Show fine differences for all displayed diff hunks."
`all' Show fine differences for all displayed diff hunks.
`t' Refine each hunk once it becomes the current section.
Keep the refinement when another section is selected.
Refreshing the buffer removes all refinement. This
variant is only provided for performance reasons."
:group 'magit-diff
:safe (lambda (val) (memq val '(nil t all)))
:type '(choice (const :tag "Never" nil)
(const :tag "Current" t)
(const :tag "All" all)))
:safe (##memq % '(nil t all))
:type '(choice (const :tag "No refinement" nil)
(const :tag "Immediately refine all hunks" all)
(const :tag "Refine each hunk when moving to it" t)))
(defcustom magit-diff-refine-ignore-whitespace smerge-refine-ignore-whitespace
"Whether to ignore whitespace changes in word-granularity differences."
@@ -258,7 +259,7 @@ The options `magit-diff-highlight-trailing' and
`magit-diff-highlight-indentation' control what kind of
whitespace errors are highlighted."
:group 'magit-diff
:safe (lambda (val) (memq val '(t nil uncommitted status)))
:safe (##memq % '(t nil uncommitted status))
:type '(choice (const :tag "In all diffs" t)
(const :tag "Only in uncommitted changes" uncommitted)
(const :tag "Never" nil)))
@@ -271,7 +272,7 @@ whitespace errors are highlighted."
`all' Highlight in added, removed and context lines."
:package-version '(magit . "3.0.0")
:group 'magit-diff
:safe (lambda (val) (memq val '(t both all)))
:safe (##memq % '(t both all))
:type '(choice (const :tag "In added lines" t)
(const :tag "In added and removed lines" both)
(const :tag "In added, removed and context lines" all)))
@@ -332,10 +333,10 @@ it receives either three or five arguments; the signature has to be
`module', `stat' and `list'."
:package-version '(magit . "4.3.1")
:group 'magit-diff
:type `(choice (function-item ,#'magit-format-file-default)
(function-item ,#'magit-format-file-all-the-icons)
(function-item ,#'magit-format-file-nerd-icons)
function))
:type `(radio (function-item ,#'magit-format-file-default)
(function-item ,#'magit-format-file-all-the-icons)
(function-item ,#'magit-format-file-nerd-icons)
function))
;;;; File Diff
@@ -897,37 +898,35 @@ and `:slant'."
;;; Commands
;;;; Prefix Commands
(eval-and-compile
(defvar magit-diff-infix-arguments
[:class transient-subgroups
["Limit arguments"
(magit:--)
(magit-diff:--ignore-submodules)
("-b" "Ignore whitespace changes" ("-b" "--ignore-space-change"))
("-w" "Ignore all whitespace" ("-w" "--ignore-all-space"))
("-D" "Omit preimage for deletes" ("-D" "--irreversible-delete")
:level 5)]
["Context arguments"
(magit-diff:-U)
("-W" "Show surrounding functions" ("-W" "--function-context"))]
["Tune arguments"
(magit-diff:--diff-algorithm)
(magit-diff:--diff-merges)
(magit-diff:-M)
(magit-diff:-C)
(magit-diff:-R :level 5)
(magit-diff:--color-moved :level 5)
(magit-diff:--color-moved-ws :level 5)
(magit-diff:--no-ext-diff)
(magit-diff:--stat)
(magit-diff:--show-signature)]]))
(transient-define-group magit-diff-infix-arguments
["Limit arguments"
(magit:--)
(magit-diff:--ignore-submodules)
("-b" "Ignore whitespace changes" ("-b" "--ignore-space-change"))
("-w" "Ignore all whitespace" ("-w" "--ignore-all-space"))
("-D" "Omit preimage for deletes" ("-D" "--irreversible-delete")
:level 5)]
["Context arguments"
(magit-diff:-U)
("-W" "Show surrounding functions" ("-W" "--function-context"))]
["Tune arguments"
(magit-diff:--diff-algorithm)
(magit-diff:--diff-merges)
(magit-diff:-M)
(magit-diff:-C)
(magit-diff:-R :level 5)
(magit-diff:--color-moved :level 5)
(magit-diff:--color-moved-ws :level 5)
(magit-diff:--no-ext-diff)
(magit-diff:--stat)
(magit-diff:--show-signature)])
;;;###autoload (autoload 'magit-diff "magit-diff" nil t)
(transient-define-prefix magit-diff ()
"Show changes between different versions."
:man-page "git-diff"
:class 'magit-diff-prefix
[magit-diff-infix-arguments]
'magit-diff-infix-arguments
["Actions"
[("d" "Dwim" magit-diff-dwim)
("r" "Diff range" magit-diff-range)
@@ -943,7 +942,7 @@ and `:slant'."
"Change the arguments used for the diff(s) in the current buffer."
:man-page "git-diff"
:class 'magit-diff-refresh-prefix
[magit-diff-infix-arguments]
'magit-diff-infix-arguments
[["Refresh"
("g" "buffer" magit-diff-refresh)
("s" "buffer and set defaults" transient-set-and-exit)
@@ -1406,7 +1405,7 @@ for a revision."
(magit-section-parent-value (magit-current-section))))))
(require 'magit)
(let* ((file (magit-file-relative-name))
(ln (and file (line-number-at-pos))))
(line (and file (line-number-at-pos))))
(magit-with-toplevel
(when module
(setq default-directory
@@ -1417,15 +1416,14 @@ for a revision."
(save-buffer))
(let ((buf (magit-revision-setup-buffer rev args files)))
(when file
(let ((line (magit-diff-visit--offset file (list "-R" rev) ln))
(let ((line (magit-diff-visit--offset file (list "-R" rev) line))
(col (current-column)))
(with-current-buffer buf
(magit-diff--goto-position file line col))))))))
(defun magit-diff--locate-hunk (file line &optional parent)
(and-let* ((diff (cl-find-if (lambda (section)
(and (cl-typep section 'magit-file-section)
(equal (oref section value) file)))
(and-let* ((diff (cl-find-if (##and (cl-typep % 'magit-file-section)
(equal (oref % value) file))
(oref (or parent magit-root-section) children))))
(let ((hunks (oref diff children)))
(cl-block nil
@@ -1458,7 +1456,6 @@ for a revision."
(when (oref section hidden)
(magit-section-show section))
(setq section (oref section parent))))
(magit-section-update-highlight)
t))
;;;; Setting Commands
@@ -1522,12 +1519,12 @@ instead."
(defun magit-diff-less-context (&optional count)
"Decrease the context for diff hunks by COUNT lines."
(interactive "p")
(magit-diff-set-context (lambda (cur) (max 0 (- (or cur 0) count)))))
(magit-diff-set-context (##max 0 (- (or % 0) count))))
(defun magit-diff-more-context (&optional count)
"Increase the context for diff hunks by COUNT lines."
(interactive "p")
(magit-diff-set-context (lambda (cur) (+ (or cur 0) count))))
(magit-diff-set-context (##+ (or % 0) count)))
(defun magit-diff-default-context ()
"Reset context for diff hunks to the default height."
@@ -1552,6 +1549,14 @@ instead."
(setq magit-buffer-diff-args val))
(magit-refresh))
(defun magit-diff-get-context ()
(string-to-number
(or (seq-some (##and (string-match "\\`-U\\([0-9]+\\)?\\'" %)
(match-string 1 %))
magit-buffer-diff-args)
(magit-get "diff.context")
"3")))
(defun magit-diff-context-p ()
(if-let ((arg (seq-find (##string-match "^-U\\([0-9]+\\)$" %)
magit-buffer-diff-args)))
@@ -1597,9 +1602,9 @@ Display the buffer in the selected window. With a prefix
argument OTHER-WINDOW display the buffer in another window
instead.
Visit the worktree version of the appropriate file. The location
of point inside the diff determines which file is being visited.
The visited version depends on what changes the diff is about.
The location of point inside the diff determines which file is
being visited. The visited version depends on what changes the
diff is about.
1. If the diff shows uncommitted changes (i.e., stage or unstaged
changes), then visit the file in the working tree (i.e., the
@@ -2125,8 +2130,8 @@ keymap is the parent of their keymaps."
"<remap> <magit-visit-thing>" #'magit-diff-visit-file
"<remap> <magit-revert-no-commit>" #'magit-reverse
"<remap> <magit-delete-thing>" #'magit-discard
"<remap> <magit-unstage-file>" #'magit-unstage
"<remap> <magit-stage-file>" #'magit-stage
"<remap> <magit-unstage-files>" #'magit-unstage
"<remap> <magit-stage-files>" #'magit-stage
"<remap> <magit-cherry-apply>" #'magit-apply
"<8>" (magit-menu-item "Rename file" #'magit-file-rename
'(:enable (eq (magit-diff-scope) 'file)))
@@ -2232,7 +2237,7 @@ keymap is the parent of their keymaps."
(unless (equal cmd "merge-tree")
(push "--ita-visible-in-index" args))
(setq args (magit-diff--maybe-add-stat-arguments args))
(when (cl-member-if (lambda (arg) (string-prefix-p "--color-moved" arg)) args)
(when (cl-member-if (##string-prefix-p "--color-moved" %) args)
(push "--color=always" args)
(setq magit-git-global-arguments
(append magit-diff--reset-non-color-moved
@@ -2240,7 +2245,7 @@ keymap is the parent of their keymaps."
(magit--git-wash #'magit-diff-wash-diffs
(if (member "--no-index" args)
'wash-anyway
(or keep-error magit--git-wash-keep-error))
(or keep-error t))
cmd args)))
(defun magit-diff--maybe-add-stat-arguments (args)
@@ -2339,7 +2344,7 @@ keymap is the parent of their keymaps."
(if (looking-at "^$") (forward-line) (insert "\n"))))))
(defun magit-diff-wash-diff (args)
(when (cl-member-if (lambda (arg) (string-prefix-p "--color-moved" arg)) args)
(when (cl-member-if (##string-prefix-p "--color-moved" %) args)
(require 'ansi-color)
(ansi-color-apply-on-region (point-min) (point-max)))
(cond
@@ -2454,7 +2459,7 @@ keymap is the parent of their keymaps."
(setq header (nreverse header))
;; KLUDGE `git-log' ignores `--no-prefix' when `-L' is used.
(when (and (derived-mode-p 'magit-log-mode)
(seq-some (lambda (arg) (string-prefix-p "-L" arg))
(seq-some (##string-prefix-p "-L" %)
magit-buffer-log-args))
(when orig
(setq orig (substring orig 2)))
@@ -2498,11 +2503,15 @@ keymap is the parent of their keymaps."
(funcall magit-format-file-function kind file face status orig))
(defun magit-format-file-default (_kind file face &optional status orig)
"Show only the Git status and the filename."
(propertize (concat (and status (format "%-11s" status))
(if orig (format "%s -> %s" orig file) file))
'font-lock-face face))
(defun magit-format-file-all-the-icons (kind file face &optional status orig)
"Show the status, filename and icon (using the `all-the-icons' package).
You have to explicitly install the `all-the-icons' package, else this
function errors."
(cl-flet ((icon (if (or (eq kind 'module) (string-suffix-p "/" file))
'all-the-icons-icon-for-dir
'all-the-icons-icon-for-file)))
@@ -2519,6 +2528,9 @@ keymap is the parent of their keymaps."
'font-lock-face face))))
(defun magit-format-file-nerd-icons (kind file face &optional status orig)
"Show the status, filename and icon (using the `nerd-icons' package).
You have to explicitly install the `nerd-icons' package, else this
function errors."
(cl-flet ((icon (if (or (eq kind 'module) (string-suffix-p "/" file))
'nerd-icons-icon-for-dir
'nerd-icons-icon-for-file)))
@@ -2616,7 +2628,6 @@ keymap is the parent of their keymaps."
(magit-delete-line)
(magit-insert-section
( hunk value nil
:washer #'magit-diff-paint-hunk
:combined combined
:from-range (if combined (butlast ranges) (car ranges))
:to-range (car (last ranges))
@@ -2631,7 +2642,7 @@ keymap is the parent of their keymaps."
(defun magit-diff-expansion-threshold (section)
"Keep new diff sections collapsed if washing takes too long."
(and (magit-file-section-p section)
(> (float-time (time-since magit-refresh-start-time))
(> (float-time (time-since magit--refresh-start-time))
magit-diff-expansion-threshold)
'hide))
@@ -2877,10 +2888,10 @@ or a ref which is not a branch, then it inserts nothing."
(defun magit-insert-revision-headers ()
"Insert headers about the commit into a revision buffer."
(magit-insert-section (headers)
(magit-insert-heading
(magit-insert-heading nil
(and-let* ((string (magit-rev-format "%D" magit-buffer-revision
"--decorate=full")))
(magit-format-ref-labels string) ?\s)
(concat (magit-format-ref-labels string) " "))
(propertize
(magit-rev-parse (magit--rev-dereference magit-buffer-revision))
'font-lock-face 'magit-hash))
@@ -2936,18 +2947,18 @@ Refer to user option `magit-revision-insert-related-refs-display-alist'."
(defun magit--insert-related-refs (rev arg title remote)
(when-let ((refs (magit-list-related-branches arg rev (and remote "-a"))))
(insert title ":" (make-string (- 10 (length title)) ?\s))
(dolist (branch refs)
(if (<= (+ (current-column) 1 (length branch))
(window-width))
(insert ?\s)
(insert ?\n (make-string 12 ?\s)))
(magit-insert-section (branch branch)
(magit-insert-section (related-refs)
(insert title ":" (make-string (- 10 (length title)) ?\s))
(dolist (branch refs)
(if (<= (+ (current-column) 1 (length branch))
(window-width))
(insert ?\s)
(insert ?\n (make-string 12 ?\s)))
(insert (propertize branch 'font-lock-face
(if (string-prefix-p "remotes/" branch)
'magit-branch-remote
'magit-branch-local)))))
(insert ?\n)))
'magit-branch-local))))
(insert ?\n))))
(defun magit-insert-revision-gravatars (rev beg)
(when (and magit-revision-show-gravatars
@@ -3100,7 +3111,7 @@ It the SECTION has a different type, then do nothing."
(defvar-keymap magit-unstaged-section-map
:doc "Keymap for the `unstaged' section."
"<remap> <magit-visit-thing>" #'magit-diff-unstaged
"<remap> <magit-stage-file>" #'magit-stage
"<remap> <magit-stage-files>" #'magit-stage
"<remap> <magit-delete-thing>" #'magit-discard
"<3>" (magit-menu-item "Discard all" #'magit-discard)
"<2>" (magit-menu-item "Stage all" #'magit-stage)
@@ -3121,7 +3132,7 @@ It the SECTION has a different type, then do nothing."
:doc "Keymap for the `staged' section."
"<remap> <magit-revert-no-commit>" #'magit-reverse
"<remap> <magit-delete-thing>" #'magit-discard
"<remap> <magit-unstage-file>" #'magit-unstage
"<remap> <magit-unstage-files>" #'magit-unstage
"<remap> <magit-visit-thing>" #'magit-diff-staged
"<4>" (magit-menu-item "Reverse all" #'magit-reverse)
"<3>" (magit-menu-item "Discard all" #'magit-discard)
@@ -3243,12 +3254,12 @@ actually a `diff' but a `diffstat' section."
(and siblings t)
(magit-diff-use-hunk-region-p)
ssection)
(`(hunk nil t ,_)
(`(hunk nil t ,_)
(if (magit-section-internal-region-p section) 'region 'hunk))
('(hunk t t nil) 'hunks)
(`(hunk ,_ ,_ ,_) 'hunk)
('(file t t nil) 'files)
(`(file ,_ ,_ ,_) 'file)
('(hunk t t nil) 'hunks)
(`(hunk ,_ ,_ ,_) 'hunk)
('(file t t nil) 'files)
(`(file ,_ ,_ ,_) 'file)
('(module t t nil) 'files)
(`(module ,_ ,_ ,_) 'file)
(`(,(or 'staged 'unstaged 'untracked) nil ,_ ,_) 'list)))))
@@ -3265,159 +3276,53 @@ actually a `diff' but a `diffstat' section."
(byte-code-function-p last-command))
(eq (region-end) (region-beginning))))))
;;; Diff Highlight
(add-hook 'magit-section-unhighlight-hook #'magit-diff-unhighlight)
(add-hook 'magit-section-highlight-hook #'magit-diff-highlight)
(defun magit-diff-unhighlight (section selection)
"Remove the highlighting of the diff-related SECTION."
(when (magit-hunk-section-p section)
(magit-diff-paint-hunk section selection nil)
t))
(defun magit-diff-highlight (section selection)
"Highlight the diff-related SECTION.
If SECTION is not a diff-related section, then do nothing and
return nil. If SELECTION is non-nil, then it is a list of sections
selected by the region, including SECTION. All of these sections
are highlighted."
(if (and (magit-section-match 'commit section)
(oref section children))
(progn (if selection
(dolist (section selection)
(magit-diff-highlight-list section selection))
(magit-diff-highlight-list section))
t)
(when-let ((scope (magit-diff-scope section t)))
(cond ((eq scope 'region)
(magit-diff-paint-hunk section selection t))
(selection
(dolist (section selection)
(magit-diff-highlight-recursive section selection)))
(t
(magit-diff-highlight-recursive section)))
t)))
(defun magit-diff-highlight-recursive (section &optional selection)
(pcase (magit-diff-scope section)
('list (magit-diff-highlight-list section selection))
('file (magit-diff-highlight-file section selection))
('hunk (magit-diff-highlight-heading section selection)
(magit-diff-paint-hunk section selection t))
(_ (magit-section-highlight section nil))))
(defun magit-diff-highlight-list (section &optional selection)
(if (oref section children)
(let ((beg (oref section start))
(cnt (oref section content))
(end (oref section end)))
(when (or (eq this-command #'mouse-drag-region)
(not selection))
(unless (and (region-active-p)
(<= (region-beginning) beg))
(magit-section-make-overlay beg cnt 'magit-section-highlight))
(if (oref section hidden)
(oset section washer #'ignore)
(dolist (child (oref section children))
(when (or (eq this-command #'mouse-drag-region)
(not (and (region-active-p)
(<= (region-beginning)
(oref child start)))))
(magit-diff-highlight-recursive child selection)))))
(when magit-diff-highlight-hunk-body
(magit-section-make-overlay (1- end) end 'magit-section-highlight)))
(magit-section-highlight section nil)))
(defun magit-diff-highlight-file (section &optional selection)
(magit-diff-highlight-heading section selection)
(when (or (not (oref section hidden))
(cl-typep section 'magit-module-section))
(dolist (child (oref section children))
(magit-diff-highlight-recursive child selection))))
(defun magit-diff-highlight-heading (section &optional selection)
(magit-section-make-overlay
(oref section start)
(or (oref section content)
(oref section end))
(pcase (list (oref section type)
(and (member section selection)
(not (eq this-command #'mouse-drag-region))))
('(file t) 'magit-diff-file-heading-selection)
('(file nil) 'magit-diff-file-heading-highlight)
('(module t) 'magit-diff-file-heading-selection)
('(module nil) 'magit-diff-file-heading-highlight)
('(hunk t) 'magit-diff-hunk-heading-selection)
('(hunk nil) 'magit-diff-hunk-heading-highlight))))
;;; Hunk Paint
(cl-defun magit-diff-paint-hunk
(section &optional selection
(highlight (magit-section-selected-p section selection)))
(let (paint)
(unless magit-diff-highlight-hunk-body
(setq highlight nil))
(cond (highlight
(unless (oref section hidden)
(cl-pushnew section magit-section-highlighted-sections)
(cond ((memq section magit-section-unhighlight-sections)
(setq magit-section-unhighlight-sections
(delq section magit-section-unhighlight-sections)))
(magit-diff-highlight-hunk-body
(setq paint t)))))
(t
(cond ((and (oref section hidden)
(memq section magit-section-unhighlight-sections))
(cl-pushnew section magit-section-highlighted-sections)
(setq magit-section-unhighlight-sections
(delq section magit-section-unhighlight-sections)))
(t
(setq paint t)))))
(when paint
(save-excursion
(goto-char (oref section start))
(let ((end (oref section end))
(merging (looking-at "@@@"))
(diff-type (magit-diff-type))
(stage nil)
(tab-width (magit-diff-tab-width
(magit-section-parent-value section))))
(forward-line)
(while (< (point) end)
(when (and magit-diff-hide-trailing-cr-characters
(char-equal ?\r (char-before (line-end-position))))
(put-text-property (1- (line-end-position)) (line-end-position)
'invisible t))
(put-text-property
(point) (1+ (line-end-position)) 'font-lock-face
(cond
((looking-at "^\\+\\+?\\([<=|>]\\)\\{7\\}")
(setq stage (pcase (list (match-string 1) highlight)
('("<" nil) 'magit-diff-our)
('("<" t) 'magit-diff-our-highlight)
('("|" nil) 'magit-diff-base)
('("|" t) 'magit-diff-base-highlight)
('("=" nil) 'magit-diff-their)
('("=" t) 'magit-diff-their-highlight)
('(">" nil) nil)))
'magit-diff-conflict-heading)
((looking-at (if merging "^\\(\\+\\| \\+\\)" "^\\+"))
(magit-diff-paint-tab merging tab-width)
(magit-diff-paint-whitespace merging 'added diff-type)
(or stage
(if highlight 'magit-diff-added-highlight 'magit-diff-added)))
((looking-at (if merging "^\\(-\\| -\\)" "^-"))
(magit-diff-paint-tab merging tab-width)
(magit-diff-paint-whitespace merging 'removed diff-type)
(if highlight 'magit-diff-removed-highlight 'magit-diff-removed))
(t
(magit-diff-paint-tab merging tab-width)
(magit-diff-paint-whitespace merging 'context diff-type)
(if highlight 'magit-diff-context-highlight 'magit-diff-context))))
(forward-line))))))
(magit-diff-update-hunk-refinement section))
(cl-defmethod magit-section-paint ((section magit-hunk-section) highlight)
(unless magit-diff-highlight-hunk-body
(setq highlight nil))
(let ((end (oref section end))
(merging (looking-at "@@@"))
(diff-type (magit-diff-type))
(stage nil)
(tab-width (magit-diff-tab-width
(magit-section-parent-value section))))
(forward-line)
(while (< (point) end)
(when (and magit-diff-hide-trailing-cr-characters
(char-equal ?\r (char-before (line-end-position))))
(put-text-property (1- (line-end-position)) (line-end-position)
'invisible t))
(put-text-property
(point) (1+ (line-end-position)) 'font-lock-face
(cond
((looking-at "^\\+\\+?\\([<=|>]\\)\\{7\\}")
(setq stage (pcase (list (match-string 1) highlight)
('("<" nil) 'magit-diff-our)
('("<" t) 'magit-diff-our-highlight)
('("|" nil) 'magit-diff-base)
('("|" t) 'magit-diff-base-highlight)
('("=" nil) 'magit-diff-their)
('("=" t) 'magit-diff-their-highlight)
('(">" nil) nil)))
'magit-diff-conflict-heading)
((looking-at (if merging "^\\(\\+\\| \\+\\)" "^\\+"))
(magit-diff-paint-tab merging tab-width)
(magit-diff-paint-whitespace merging 'added diff-type)
(or stage
(if highlight 'magit-diff-added-highlight 'magit-diff-added)))
((looking-at (if merging "^\\(-\\| -\\)" "^-"))
(magit-diff-paint-tab merging tab-width)
(magit-diff-paint-whitespace merging 'removed diff-type)
(if highlight 'magit-diff-removed-highlight 'magit-diff-removed))
(t
(magit-diff-paint-tab merging tab-width)
(magit-diff-paint-whitespace merging 'context diff-type)
(if highlight 'magit-diff-context-highlight 'magit-diff-context))))
(forward-line)))
(when (eq magit-diff-refine-hunk 'all)
(magit-diff-update-hunk-refinement section))
(oset section painted (if highlight 'highlight 'plain)))
(defvar magit-diff--tab-width-cache nil)
@@ -3490,7 +3395,11 @@ are highlighted."
(overlay-put ov 'font-lock-face 'magit-diff-whitespace-warning)
(overlay-put ov 'priority 2)
(overlay-put ov 'evaporate t))))))
(cl-defmethod magit-section--refine ((section magit-hunk-section))
(when (eq magit-diff-refine-hunk t)
(magit-diff-update-hunk-refinement section)))
(defun magit-diff-update-hunk-refinement (&optional section allow-remove)
(if section
(unless (oref section hidden)
@@ -3504,22 +3413,22 @@ are highlighted."
;; `diff-refine-hunk' does not handle combined diffs.
(unless (looking-at "@@@")
(let ((smerge-refine-ignore-whitespace
magit-diff-refine-ignore-whitespace)
magit-diff-refine-ignore-whitespace)
;; Avoid fsyncing many small temp files.
(write-region-inhibit-fsync t))
(diff-refine-hunk)))))
(diff-refine-hunk)))))
((and (guard allow-remove)
(or `(nil t ,_) '(t t nil)))
(oset section refined nil)
(remove-overlays (oref section start)
(oref section end)
'diff-mode 'fine))))
(cl-labels ((recurse (section)
(if (magit-section-match 'hunk section)
(if (magit-section-match 'hunk section)
(magit-diff-update-hunk-refinement section t)
(dolist (child (oref section children))
(recurse child)))))
(recurse magit-root-section))))
;;; Hunk Region