Commit ddce6ce4 authored by Jonas Bernoulli's avatar Jonas Bernoulli

sections: Use oref instead of dedicated slot accessors

parent 645c6c1f
......@@ -113,10 +113,10 @@ so causes the change to be applied to the index as well."
(`(,_ files) (magit-apply-diffs it args)))))
(defun magit-apply--section-content (section)
(buffer-substring-no-properties (if (eq (magit-section-type section) 'hunk)
(magit-section-start section)
(magit-section-content section))
(magit-section-end section)))
(buffer-substring-no-properties (if (eq (oref section type) 'hunk)
(oref section start)
(oref section content))
(oref section end)))
(defun magit-apply-diffs (sections &rest args)
(setq sections (magit-apply--get-diffs sections))
......@@ -134,8 +134,8 @@ so causes the change to be applied to the index as well."
(magit-apply--section-content section))))
(defun magit-apply-hunks (sections &rest args)
(let ((section (magit-section-parent (car sections))))
(when (string-match "^diff --cc" (magit-section-value section))
(let ((section (oref (car sections) parent)))
(when (string-match "^diff --cc" (oref section value))
(user-error "Cannot un-/stage resolution hunks. Stage the whole file"))
(magit-apply-patch section args
(concat (oref section header)
......@@ -145,7 +145,7 @@ so causes the change to be applied to the index as well."
(defun magit-apply-hunk (section &rest args)
(when (string-match "^diff --cc" (magit-section-parent-value section))
(user-error "Cannot un-/stage resolution hunks. Stage the whole file"))
(magit-apply-patch (magit-section-parent section) args
(magit-apply-patch (oref section parent) args
(concat (magit-diff-file-header section)
(magit-apply--section-content section))))
......@@ -154,14 +154,14 @@ so causes the change to be applied to the index as well."
(user-error "Not enough context to apply region. Increase the context"))
(when (string-match "^diff --cc" (magit-section-parent-value section))
(user-error "Cannot un-/stage resolution hunks. Stage the whole file"))
(magit-apply-patch (magit-section-parent section) args
(magit-apply-patch (oref section parent) args
(concat (magit-diff-file-header section)
(magit-diff-hunk-region-patch section args))))
(defun magit-apply-patch (section:s args patch)
(let* ((files (if (atom section:s)
(list (magit-section-value section:s))
(mapcar 'magit-section-value section:s)))
(list (oref section:s value))
(--map (oref it value) section:s)))
(command (symbol-name this-command))
(command (if (and command (string-match "^magit-\\([^-]+\\)" command))
(match-string 1 command)
......@@ -182,18 +182,18 @@ so causes the change to be applied to the index as well."
(defun magit-apply--get-selection ()
(or (magit-region-sections '(hunk file) t)
(let ((section (magit-current-section)))
(pcase (magit-section-type section)
(pcase (oref section type)
((or `hunk `file) section)
((or `staged `unstaged `untracked
`stashed-index `stashed-worktree `stashed-untracked)
(magit-section-children section))
(oref section children))
(_ (user-error "Cannot apply this, it's not a change"))))))
(defun magit-apply--get-diffs (sections)
(magit-section-case
([file diffstat]
(--map (or (magit-get-section
(append `((file . ,(magit-section-value it)))
(append `((file . ,(oref it value)))
(magit-section-ident magit-root-section)))
(error "Cannot get required diff headers"))
sections))
......@@ -228,7 +228,7 @@ at point, stage the file but not its content."
(`(unstaged file t) (magit-apply-diff it "--cached"))
(`(unstaged files t) (magit-apply-diffs it "--cached"))
(`(unstaged list t) (magit-apply-diffs it "--cached"))
(`(unstaged file nil) (magit-stage-1 "-u" (list (magit-section-value it))))
(`(unstaged file nil) (magit-stage-1 "-u" (list (oref it value))))
(`(unstaged files nil) (magit-stage-1 "-u" (magit-region-values nil t)))
(`(unstaged list nil) (magit-stage-modified))
(`(staged ,_ ,_) (user-error "Already staged"))
......@@ -279,7 +279,7 @@ ignored) files."
(defun magit-stage-untracked (&optional intent)
(let* ((section (magit-current-section))
(files (pcase (magit-diff-scope)
(`file (list (magit-section-value section)))
(`file (list (oref section value)))
(`files (magit-region-values nil t))
(`list (magit-untracked-files))))
plain repos)
......@@ -296,9 +296,9 @@ ignored) files."
(mapc #'magit-turn-on-auto-revert-mode-if-desired plain)))
(dolist (repo repos)
(save-excursion
(goto-char (magit-section-start
(magit-get-section
`((file . ,repo) (untracked) (status)))))
(goto-char (oref (magit-get-section
`((file . ,repo) (untracked) (status)))
start))
(let* ((topdir (magit-toplevel))
(package
(and (equal (bound-and-true-p borg-user-emacs-directory)
......@@ -341,7 +341,7 @@ ignored) files."
(`(staged file t) (magit-apply-diff it "--reverse" "--cached"))
(`(staged files t) (magit-apply-diffs it "--reverse" "--cached"))
(`(staged list t) (magit-apply-diffs it "--reverse" "--cached"))
(`(staged file nil) (magit-unstage-1 (list (magit-section-value it))))
(`(staged file nil) (magit-unstage-1 (list (oref it value))))
(`(staged files nil) (magit-unstage-1 (magit-region-values nil t)))
(`(staged list nil) (magit-unstage-all))
(`(committed ,_ ,_) (if magit-unstage-committed
......@@ -414,8 +414,8 @@ without requiring confirmation."
(if (eq (magit-diff-type section) 'unstaged)
(funcall apply section "--reverse")
(if (magit-anything-unstaged-p
nil (if (eq (magit-section-type section) 'file)
(magit-section-value section)
nil (if (eq (oref section type) 'file)
(oref section value)
(magit-section-parent-value section)))
(progn (let ((inhibit-magit-refresh t))
(funcall apply section "--reverse" "--cached")
......@@ -435,8 +435,8 @@ without requiring confirmation."
(if (eq (magit-diff-type section) 'unstaged)
(funcall apply sections "--reverse")
(if (magit-anything-unstaged-p
nil (if (eq (magit-section-type section) 'file)
(magit-section-value section)
nil (if (eq (oref section type) 'file)
(oref section value)
(magit-section-parent-value section)))
(progn (let ((inhibit-magit-refresh t))
(funcall apply sections "--reverse" "--cached")
......@@ -453,7 +453,7 @@ without requiring confirmation."
(status (magit-file-status))
files delete resurrect rename discard discard-new resolve)
(dolist (section sections)
(let ((file (magit-section-value section)))
(let ((file (oref section value)))
(push file files)
(pcase (cons (pcase type
(`staged ?X)
......@@ -536,7 +536,7 @@ without requiring confirmation."
(magit-call-git "reset" "--" orig))))))
(defun magit-discard-files--discard (sections new-files)
(let ((files (mapcar #'magit-section-value sections)))
(let ((files (--map (oref it value) sections)))
(when (magit-confirm-files
'discard (append files new-files)
(format "Discard %s changes in" (magit-diff-type)))
......@@ -548,7 +548,7 @@ without requiring confirmation."
(let ((binaries (magit-staged-binary-files)))
(when binaries
(setq sections
(--filter (not (member (magit-section-value it) binaries))
(--filter (not (member (oref it value) binaries))
sections)))
(cond ((= (length sections) 1)
(magit-discard-apply (car sections) 'magit-apply-diff))
......@@ -604,8 +604,9 @@ so causes the change to be applied to the index as well."
(defun magit-reverse-files (sections args)
(-let [(binaries sections)
(let ((bs (magit-staged-binary-files)))
(--separate (member (magit-section-value it) bs) sections))]
(when (magit-confirm-files 'reverse (mapcar #'magit-section-value sections))
(--separate (member (oref it value) bs)
sections))]
(when (magit-confirm-files 'reverse (--map (oref it value) sections))
(if (= (length sections) 1)
(magit-reverse-apply (car sections) 'magit-apply-diff args)
(magit-reverse-apply sections 'magit-apply-diffs args)))
......
......@@ -51,8 +51,9 @@ This function will:
(when (derived-mode-p 'magit-mode)
(-when-let (hidden-sections (bookmark-prop-get bookmark
'magit-hidden-sections))
(--each (magit-section-children magit-root-section)
(if (member (cons (magit-section-type it) (magit-section-value it))
(--each (oref magit-root-section children)
(if (member (cons (oref it type)
(oref it value))
hidden-sections)
(magit-section-hide it)
(magit-section-show it)))))
......@@ -87,9 +88,10 @@ specifies additional properties to store in the bookmark."
(when (derived-mode-p 'magit-mode)
(bookmark-prop-set
bookmark 'magit-hidden-sections
(--map (cons (magit-section-type it) (magit-section-value it))
(-filter #'magit-section-hidden
(magit-section-children magit-root-section)))))
(--map (cons (oref it type)
(oref it value))
(--filter (oref it hidden)
(oref magit-root-section children)))))
(when make-props
(pcase-dolist (`(,prop . ,value) (apply make-props magit-refresh-args))
(bookmark-prop-set bookmark prop value)))
......@@ -340,12 +342,12 @@ specifies additional properties to store in the bookmark."
(magit-args . ,args)
(magit-files . ,files)
(magit-hidden-sections
. ,(--map `(,(magit-section-type it)
. ,(--map `(,(oref it type)
. ,(replace-regexp-in-string (regexp-quote stash)
magit-buffer-revision-hash
(magit-section-value it)))
(-filter #'magit-section-hidden
(magit-section-children magit-root-section))))))))
(oref it value)))
(--filter (oref it hidden)
(oref magit-root-section children))))))))
;;; Submodules
......
This diff is collapsed.
......@@ -285,7 +285,7 @@ mind at all, then it asks the user for a command to run."
(interactive)
(magit-section-case
(hunk (save-excursion
(goto-char (magit-section-start (magit-section-parent it)))
(goto-char (oref (oref it parent) start))
(magit-ediff-dwim)))
(t
(let ((range (magit-diff--dwim))
......
......@@ -704,7 +704,7 @@ Sorted from longest to shortest CYGWIN name."
(defun magit-file-at-point ()
(magit-section-case
(file (magit-section-value it))
(file (oref it value))
(hunk (magit-section-parent-value it))))
(defun magit-current-file ()
......@@ -904,22 +904,22 @@ to, or to some other symbolic-ref that points to the same ref."
(defun magit-branch-at-point ()
(magit-section-case
(branch (magit-section-value it))
(commit (magit-name-branch (magit-section-value it)))))
(branch (oref it value))
(commit (magit-name-branch (oref it value)))))
(defun magit-local-branch-at-point ()
(magit-section-case
(branch (let ((branch (magit-ref-maybe-qualify (magit-section-value it))))
(branch (let ((branch (magit-ref-maybe-qualify (oref it value))))
(when (member branch (magit-list-local-branch-names))
branch)))
(commit (magit-name-local-branch (magit-section-value it)))))
(commit (magit-name-local-branch (oref it value)))))
(defun magit-remote-branch-at-point ()
(magit-section-case
(branch (let ((branch (magit-section-value it)))
(branch (let ((branch (oref it value)))
(when (member branch (magit-list-remote-branch-names))
branch)))
(commit (magit-name-remote-branch (magit-section-value it)))))
(commit (magit-name-remote-branch (oref it value)))))
(defun magit-commit-at-point ()
(or (magit-section-when commit)
......@@ -929,10 +929,10 @@ to, or to some other symbolic-ref that points to the same ref."
(defun magit-branch-or-commit-at-point ()
(or magit-buffer-refname
(magit-section-case
(branch (magit-ref-maybe-qualify (magit-section-value it)))
(commit (let ((rev (magit-section-value it)))
(branch (magit-ref-maybe-qualify (oref it value)))
(commit (let ((rev (oref it value)))
(or (magit-get-shortname rev) rev)))
(tag (magit-ref-maybe-qualify (magit-section-value it) "tags/")))
(tag (magit-ref-maybe-qualify (oref it value) "tags/")))
(thing-at-point 'git-revision t)
(and (derived-mode-p 'magit-revision-mode
'magit-merge-preview-mode)
......@@ -940,15 +940,15 @@ to, or to some other symbolic-ref that points to the same ref."
(defun magit-tag-at-point ()
(magit-section-case
(tag (magit-section-value it))
(commit (magit-name-tag (magit-section-value it)))))
(tag (oref it value))
(commit (magit-name-tag (oref it value)))))
(defun magit-stash-at-point ()
(magit-section-when stash))
(defun magit-remote-at-point ()
(magit-section-case
(remote (magit-section-value it))
(remote (oref it value))
(branch (magit-section-parent-value it))))
(defun magit-get-current-branch ()
......
......@@ -55,19 +55,19 @@ This function is used as a helper for functions set as
(while (magit-section--backward-find
(lambda ()
(let* ((section (magit-current-section))
(type (magit-section-type section))
(parent (magit-section-parent section))
(parent-type (magit-section-type parent)))
(type (oref section type))
(parent (oref section parent))
(parent-type (oref parent type)))
(and (-contains-p entry-types type)
(-contains-p menu-types parent-type)))))
(let* ((section (magit-current-section))
(name (buffer-substring-no-properties
(line-beginning-position)
(line-end-position)))
(parent (magit-section-parent section))
(parent (oref section parent))
(parent-title (buffer-substring-no-properties
(magit-section-start parent)
(1- (magit-section-content parent)))))
(oref parent start)
(1- (oref parent content)))))
(puthash parent-title
(cons (cons name (point))
(gethash parent-title entries (list)))
......@@ -86,7 +86,7 @@ This function is used as a value for
(magit-section--backward-find
(lambda ()
(-contains-p '(commit stash)
(magit-section-type (magit-current-section))))))
(oref (magit-current-section) type)))))
;;;###autoload
(defun magit-imenu--log-extract-index-name-function ()
......@@ -109,10 +109,10 @@ This function is used as a value for
`imenu-prev-index-position-function'."
(magit-section--backward-find
(lambda ()
(and (equal (magit-section-type (magit-current-section)) 'file)
(not (equal (magit-section-type
(magit-section-parent (magit-current-section)))
'diffstat))))))
(let ((section (magit-current-section)))
(and (equal (oref section type) 'file)
(not (equal (oref (oref section parent) type)
'diffstat)))))))
;;;###autoload
(defun magit-imenu--diff-extract-index-name-function ()
......@@ -204,9 +204,7 @@ This function is used as a value for
`imenu-prev-index-position-function'."
(magit-section--backward-find
(lambda ()
(eq
(magit-section-type (magit-current-section))
'process))))
(eq (oref (magit-current-section) type) 'process))))
;;;###autoload
(defun magit-imenu--process-extract-index-name-function ()
......
......@@ -773,9 +773,9 @@ is displayed in the current frame."
(interactive "p")
(when (derived-mode-p 'magit-log-mode)
(magit-section-when commit
(let ((parent-rev (format "%s^%s" (magit-section-value it) (or n 1))))
(let ((parent-rev (format "%s^%s" (oref it value) (or n 1))))
(-if-let (parent-hash (magit-rev-parse "--short" parent-rev))
(-if-let (section (--first (equal (magit-section-value it)
(-if-let (section (--first (equal (oref it value)
parent-hash)
(magit-section-siblings it 'next)))
(magit-section-goto section)
......@@ -1019,8 +1019,8 @@ Do not add this to a hook variable."
(cl-return-from magit-log-wash-rev t))
(magit-insert-section section (commit hash)
(pcase style
(`stash (setf (magit-section-type section) 'stash))
(`module (setf (magit-section-type section) 'module-commit))
(`stash (oset section type 'stash))
(`module (oset section type 'module-commit))
(`bisect-log (setq hash (magit-rev-parse "--short" hash))))
(when cherry
(when (and (derived-mode-p 'magit-refs-mode)
......@@ -1098,7 +1098,7 @@ Do not add this to a hook variable."
(let ((limit (save-excursion
(and (re-search-forward non-graph-re nil t)
(match-beginning 0)))))
(unless (magit-section-content magit-insert-section--current)
(unless (oref magit-insert-section--current content)
(magit-insert-heading))
(delete-char (if (looking-at "\n") 1 4))
(magit-diff-wash-diffs (list "--stat") limit))
......@@ -1143,7 +1143,7 @@ having to press \"+\".
This function is called by `magit-section-movement-hook' and
exists mostly for backward compatibility reasons."
(when (and (eq (magit-section-type section) 'longer)
(when (and (eq (oref section type) 'longer)
magit-log-auto-more)
(magit-log-double-commit-limit)
(forward-line -1)
......@@ -1204,13 +1204,12 @@ If there is no blob buffer in the same frame, then do nothing."
(defun magit-log-goto-same-commit ()
(-when-let* ((prev magit-previous-section)
(rev (cond ((magit-section-match 'commit prev)
(magit-section-value prev))
(oref prev value))
((magit-section-match 'branch prev)
(magit-rev-format
"%h" (magit-section-value prev)))))
(same (--first (equal (magit-section-value it) rev)
(magit-section-children magit-root-section))))
(goto-char (magit-section-start same))))
(magit-rev-format "%h" (oref prev value)))))
(same (--first (equal (oref it value) rev)
(oref magit-root-section children))))
(goto-char (oref same start))))
;;; Log Margin
......@@ -1531,7 +1530,7 @@ then show the last `magit-log-section-commit-count' commits."
'((unpushed . "@{upstream}..")
(status))
magit-insert-section--oldroot))
(magit-section-hidden it)
(oref it hidden)
nil))
(magit-insert-unpushed-to-upstream
(--if-let (and magit-insert-section--oldroot
......@@ -1540,7 +1539,7 @@ then show the last `magit-log-section-commit-count' commits."
magit-log-section-commit-count))
(status))
magit-insert-section--oldroot))
(magit-section-hidden it)
(oref it hidden)
t)))))
(defun magit-insert-unpushed-to-upstream (&optional collapse)
......
......@@ -1034,10 +1034,10 @@ Run hooks `magit-pre-refresh-hook' and `magit-post-refresh-hook'."
(defun magit-refresh-get-relative-position ()
(-when-let (section (magit-current-section))
(let ((start (magit-section-start section)))
(let ((start (oref section start)))
(list (count-lines start (point))
(- (point) (line-beginning-position))
(and (eq (magit-section-type section) 'hunk)
(and (eq (oref section type) 'hunk)
(region-active-p)
(progn (goto-char (line-beginning-position))
(when (looking-at "^[-+]") (forward-line))
......
......@@ -286,7 +286,7 @@ optional NODISPLAY is non-nil also display it."
"Kill the process at point."
(interactive)
(magit-section-when process
(let ((process (magit-section-value it)))
(let ((process (oref it value)))
(if (eq (process-status process) 'run)
(when (magit-confirm 'kill-process)
(kill-process process))
......@@ -540,7 +540,7 @@ Magit status buffer."
(process-put process 'default-dir default-directory)
(when inhibit-magit-refresh
(process-put process 'inhibit-refresh t))
(setf (magit-section-process section) process)
(oset section process process)
(with-current-buffer process-buf
(set-marker (process-mark process) (point)))
(when input
......@@ -548,7 +548,7 @@ Magit status buffer."
(process-send-region process (point-min) (point-max))
(process-send-eof process)))
(setq magit-this-process process)
(setf (magit-section-value section) process)
(oset section value process)
(magit-process-display-buffer process)
process))
......@@ -599,23 +599,23 @@ Magit status buffer."
(defun magit-process-truncate-log ()
(let* ((head nil)
(tail (magit-section-children magit-root-section))
(tail (oref magit-root-section children))
(count (length tail)))
(when (> (1+ count) magit-process-log-max)
(while (and (cdr tail)
(> count (/ magit-process-log-max 2)))
(let* ((inhibit-read-only t)
(section (car tail))
(process (magit-section-process section)))
(process (oref section process)))
(cond ((not process))
((memq (process-status process) '(exit signal))
(delete-region (magit-section-start section)
(1+ (magit-section-end section)))
(delete-region (oref section start)
(1+ (oref section end)))
(cl-decf count))
(t
(push section head))))
(pop tail))
(setf (magit-section-children magit-root-section)
(oset magit-root-section children
(nconc (reverse head) tail)))))
(defun magit-process-sentinel (process event)
......@@ -654,7 +654,7 @@ Magit status buffer."
((or "rebase" "am") 'rebase-sequence)
((or "cherry-pick" "revert") 'sequence)))
(status)))
(goto-char (magit-section-start it))
(goto-char (oref it start))
(magit-section-update-highlight))))))))
(defun magit-process-filter (proc string)
......@@ -920,15 +920,15 @@ If STR is supplied, it replaces the `mode-line-process' text."
"A one-line error summary from the given SECTION."
(or (and (buffer-live-p process-buf)
(with-current-buffer process-buf
(and (magit-section-content section)
(and (oref section content)
(save-excursion
(goto-char (magit-section-end section))
(goto-char (oref section end))
(run-hook-wrapped
'magit-process-error-message-regexps
(lambda (re)
(save-excursion
(and (re-search-backward
re (magit-section-start section) t)
re (oref section start) t)
(or (match-string-no-properties 1)
(and (not magit-process-raise-error)
'suppressed))))))))))
......@@ -943,19 +943,19 @@ Limited by `magit-process-error-tooltip-max-lines'."
(buffer-live-p process-buf)
(with-current-buffer process-buf
(save-excursion
(goto-char (or (magit-section-content section)
(magit-section-start section)))
(goto-char (or (oref section content)
(oref section start)))
(buffer-substring-no-properties
(point)
(save-excursion
(forward-line magit-process-error-tooltip-max-lines)
(goto-char
(if (> (point) (magit-section-end section))
(magit-section-end section)
(if (> (point) (oref section end))
(oref section end)
(point)))
;; Remove any trailing whitespace.
(when (re-search-backward "[^[:space:]\n]"
(magit-section-start section) t)
(oref section start) t)
(forward-char 1))
(point)))))))
......@@ -976,7 +976,7 @@ Limited by `magit-process-error-tooltip-max-lines'."
(when (buffer-live-p process-buf)
(with-current-buffer process-buf
(let ((inhibit-read-only t)
(marker (magit-section-start section)))
(marker (oref section start)))
(goto-char marker)
(save-excursion
(delete-char 3)
......@@ -988,14 +988,14 @@ Limited by `magit-process-error-tooltip-max-lines'."
'magit-process-ng)))
(set-marker-insertion-type marker t))
(when magit-process-finish-apply-ansi-colors
(ansi-color-apply-on-region (magit-section-content section)
(magit-section-end section)))
(if (= (magit-section-end section)
(ansi-color-apply-on-region (oref section content)
(oref section end)))
(if (= (oref section end)
(+ (line-end-position) 2))
(save-excursion
(goto-char (1+ (line-end-position)))
(delete-char -1)
(setf (magit-section-content section) nil))
(oset section content nil))
(let ((buf (magit-process-buffer t)))
(when (and (= arg 0)
(not (--any-p (eq (window-buffer it) buf)
......
......@@ -344,7 +344,7 @@ different, but only if you have customized the option
(interactive)
(if (and (derived-mode-p 'magit-refs-mode)
(magit-section-match '(branch tag)))
(let ((ref (magit-section-value (magit-current-section))))
(let ((ref (oref (magit-current-section) value)))
(cond (current-prefix-arg
(cond ((memq 'focus-on-ref magit-visit-ref-behavior)
(magit-show-refs ref))
......@@ -603,8 +603,8 @@ line is inserted at all."
;;;; Cherry Sections
(defun magit-refs-insert-cherry-commits (head ref section)
(if (magit-section-hidden section)
(setf (magit-section-washer section)
(if (oref section hidden)
(oset section washer
(apply-partially #'magit-refs-insert-cherry-commits-1
head ref section))
(magit-refs-insert-cherry-commits-1 head ref section)))
......
This diff is collapsed.
......@@ -461,7 +461,8 @@ that make up the stash."
(magit-insert-section section (note)
(magit-insert-heading "Notes")
(magit-git-insert "notes" "show" (car magit-refresh-args))
(if (= (point) (magit-section-content section))
(if (= (point)
(oref section content))
(magit-cancel-section)
(insert "\n"))))
......
......@@ -236,8 +236,8 @@ whether they are wrapped in an additional section."
(format "%s (%s)"
(propertize "Modules" 'face 'magit-section-heading)
(length modules)))
(if (magit-section-hidden section)
(setf (magit-section-washer section) 'magit--insert-modules)
(if (oref section hidden)
(oset section washer 'magit--insert-modules)
(magit--insert-modules)))
(magit--insert-modules))))
......@@ -255,8 +255,8 @@ or, failing that, the abbreviated HEAD commit hash."
(format "%s (%s)"
(propertize "Modules overview" 'face 'magit-section-heading)
(length modules)))
(if (magit-section-hidden section)
(setf (magit-section-washer section) 'magit--insert-modules-overview)
(if (oref section hidden)
(oset section washer 'magit--insert-modules-overview)
(magit--insert-modules-overview)))))
(defvar magit-modules-overview-align-numbers t)
......@@ -383,9 +383,11 @@ These sections can be expanded to show the respective commits."
(concat (propertize module 'face 'magit-diff-file-heading) ":"))
(magit-git-wash (apply-partially 'magit-log-wash-log 'module)
"-c" "push.default=current" "log" "--oneline" range)
(when (> (point) (magit-section-content sec))
(when (> (point)
(oref sec content))
(delete-char -1)))))))
(if (> (point) (magit-section-content section))
(if (> (point)
(oref section content))
(insert ?\n)
(magit-cancel-section)))))
......
......@@ -807,7 +807,7 @@ above."
(if (use-region-p)
(copy-region-as-kill nil nil 'region)
(-when-let* ((section (magit-current-section))
(value (magit-section-value section)))
(value (oref section value)))
(magit-section-case
((branch commit module-commit tag)
(let ((default-directory default-directory) ref)
......
......@@ -254,9 +254,9 @@
(defun magit-test-get-section (list file)
(magit-status-internal default-directory)
(--first (equal (magit-section-value it) file)
(magit-section-children
(magit-get-section `(,list (status))))))
(--first (equal (oref it value) file)
(oref (magit-get-section `(,list (status)))
children)))
(ert-deftest magit-status:file-sections ()
(magit-with-test-repository
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment