Refactored magit-update-status.
This commit is contained in:
parent
d045293801
commit
5f34a05b3a
1 changed files with 30 additions and 20 deletions
50
magit.el
50
magit.el
|
@ -824,6 +824,14 @@ Please see the manual for a complete description of Magit.
|
||||||
(forward-line))
|
(forward-line))
|
||||||
t))
|
t))
|
||||||
|
|
||||||
|
(defun magit-insert-untracked-files ()
|
||||||
|
(magit-insert-section 'untracked
|
||||||
|
"Untracked files:"
|
||||||
|
'magit-wash-untracked-files
|
||||||
|
nil
|
||||||
|
"git" "ls-files" "--others"
|
||||||
|
"--exclude-standard"))
|
||||||
|
|
||||||
;;; Diffs and Hunks
|
;;; Diffs and Hunks
|
||||||
|
|
||||||
(defun magit-diff-line-file ()
|
(defun magit-diff-line-file ()
|
||||||
|
@ -926,6 +934,16 @@ Please see the manual for a complete description of Magit.
|
||||||
(forward-line))
|
(forward-line))
|
||||||
target))))
|
target))))
|
||||||
|
|
||||||
|
(defun magit-insert-unstaged-changes (title)
|
||||||
|
(magit-insert-section 'unstaged title 'magit-wash-diffs
|
||||||
|
magit-collapse-threshold
|
||||||
|
"git" "diff"))
|
||||||
|
|
||||||
|
(defun magit-insert-staged-changes ()
|
||||||
|
(magit-insert-section 'staged "Staged changes:" 'magit-wash-diffs
|
||||||
|
magit-collapse-threshold
|
||||||
|
"git" "diff" "--cached"))
|
||||||
|
|
||||||
;;; Logs and Commits
|
;;; Logs and Commits
|
||||||
|
|
||||||
(defun magit-wash-log-line ()
|
(defun magit-wash-log-line ()
|
||||||
|
@ -1002,6 +1020,13 @@ Please see the manual for a complete description of Magit.
|
||||||
(or magit-marked-commit
|
(or magit-marked-commit
|
||||||
(error "Not commit marked")))
|
(error "Not commit marked")))
|
||||||
|
|
||||||
|
(defun magit-insert-unpushed-commits (remote branch)
|
||||||
|
(magit-insert-section 'unpushed
|
||||||
|
"Unpushed commits:" 'magit-wash-log
|
||||||
|
nil
|
||||||
|
"git" "log" "--graph" "--pretty=oneline"
|
||||||
|
(format "%s/%s..HEAD" remote branch)))
|
||||||
|
|
||||||
;;; Status
|
;;; Status
|
||||||
|
|
||||||
(defun magit-update-status (buf)
|
(defun magit-update-status (buf)
|
||||||
|
@ -1033,29 +1058,14 @@ Please see the manual for a complete description of Magit.
|
||||||
(if rebase
|
(if rebase
|
||||||
(insert (apply 'format "Rebasing: %s (%s of %s)\n" rebase))))
|
(insert (apply 'format "Rebasing: %s (%s of %s)\n" rebase))))
|
||||||
(insert "\n")
|
(insert "\n")
|
||||||
(magit-insert-section 'untracked
|
(magit-insert-untracked-files)
|
||||||
"Untracked files:"
|
|
||||||
'magit-wash-untracked-files
|
|
||||||
nil
|
|
||||||
"git" "ls-files" "--others"
|
|
||||||
"--exclude-standard")
|
|
||||||
(let ((staged (magit-anything-staged-p)))
|
(let ((staged (magit-anything-staged-p)))
|
||||||
(magit-insert-section 'unstaged
|
(magit-insert-unstaged-changes
|
||||||
(if staged "Unstaged changes:" "Changes:")
|
(if staged "Unstaged changes:" "Changes:"))
|
||||||
'magit-wash-diffs
|
|
||||||
magit-collapse-threshold
|
|
||||||
"git" "diff")
|
|
||||||
(if staged
|
(if staged
|
||||||
(magit-insert-section 'staged
|
(magit-insert-staged-changes)))
|
||||||
"Staged changes:" 'magit-wash-diffs
|
|
||||||
magit-collapse-threshold
|
|
||||||
"git" "diff" "--cached")))
|
|
||||||
(if remote
|
(if remote
|
||||||
(magit-insert-section 'unpushed
|
(magit-insert-unpushed-commits remote branch)))))
|
||||||
"Unpushed commits:" 'magit-wash-log
|
|
||||||
nil
|
|
||||||
"git" "log" "--graph" "--pretty=oneline"
|
|
||||||
(format "%s/%s..HEAD" remote branch))))))
|
|
||||||
(magit-goto-line old-line)
|
(magit-goto-line old-line)
|
||||||
(when (bobp)
|
(when (bobp)
|
||||||
(magit-goto-section '(unstaged)))
|
(magit-goto-section '(unstaged)))
|
||||||
|
|
Loading…
Reference in a new issue