Pass "--no-pager" to Git.
* magit.el (magit-git-standard-options): New. Changed almost all uses of magit-git-executable to also pass magit-git-standard-options.
This commit is contained in:
parent
35ea9ab265
commit
1e3f94437e
1 changed files with 155 additions and 145 deletions
252
magit.el
252
magit.el
|
@ -166,6 +166,8 @@ Many Magit faces inherit from this one by default."
|
||||||
"Face for branch head labels shown in log buffer."
|
"Face for branch head labels shown in log buffer."
|
||||||
:group 'magit)
|
:group 'magit)
|
||||||
|
|
||||||
|
(defconst magit-git-standard-options '("--no-pager"))
|
||||||
|
|
||||||
;;; Macros
|
;;; Macros
|
||||||
|
|
||||||
(defmacro magit-with-refresh (&rest body)
|
(defmacro magit-with-refresh (&rest body)
|
||||||
|
@ -186,18 +188,20 @@ Many Magit faces inherit from this one by default."
|
||||||
(goto-char 1)
|
(goto-char 1)
|
||||||
(forward-line (1- line))))
|
(forward-line (1- line))))
|
||||||
|
|
||||||
(defun magit-shell (cmd &rest args)
|
(defun magit-format-shell-command (fmt args)
|
||||||
(let ((str (shell-command-to-string
|
(apply 'format fmt (mapcar #'magit-escape-for-shell args)))
|
||||||
(apply 'format cmd (mapcar #'magit-escape-for-shell args)))))
|
|
||||||
(if (string= str "")
|
|
||||||
nil
|
|
||||||
(if (equal (elt str (- (length str) 1)) ?\n)
|
|
||||||
(substring str 0 (- (length str) 1))
|
|
||||||
str))))
|
|
||||||
|
|
||||||
(defun magit-shell-lines (cmd &rest args)
|
(defun magit-format-git-command (fmt args)
|
||||||
(let ((str (shell-command-to-string
|
(concat (magit-concat-with-delim
|
||||||
(apply 'format cmd (mapcar #'magit-escape-for-shell args)))))
|
" "
|
||||||
|
(mapcar #'magit-escape-for-shell
|
||||||
|
(cons magit-git-executable
|
||||||
|
magit-git-standard-options)))
|
||||||
|
" "
|
||||||
|
(magit-format-shell-command fmt args)))
|
||||||
|
|
||||||
|
(defun magit-shell-lines (command)
|
||||||
|
(let ((str (shell-command-to-string command)))
|
||||||
(if (string= str "")
|
(if (string= str "")
|
||||||
nil
|
nil
|
||||||
(let ((lines (nreverse (split-string str "\n"))))
|
(let ((lines (nreverse (split-string str "\n"))))
|
||||||
|
@ -205,14 +209,28 @@ Many Magit faces inherit from this one by default."
|
||||||
(setq lines (cdr lines)))
|
(setq lines (cdr lines)))
|
||||||
(nreverse lines)))))
|
(nreverse lines)))))
|
||||||
|
|
||||||
(defun magit-shell-exit-code (cmd &rest args)
|
(defun magit-shell (command)
|
||||||
|
(let ((str (shell-command-to-string command)))
|
||||||
|
(if (string= str "")
|
||||||
|
nil
|
||||||
|
(if (equal (elt str (- (length str) 1)) ?\n)
|
||||||
|
(substring str 0 (- (length str) 1))
|
||||||
|
str))))
|
||||||
|
|
||||||
|
(defun magit-git-lines (fmt &rest args)
|
||||||
|
(magit-shell-lines (magit-format-git-command fmt args)))
|
||||||
|
|
||||||
|
(defun magit-git-string (fmt &rest args)
|
||||||
|
(magit-shell (magit-format-git-command fmt args)))
|
||||||
|
|
||||||
|
(defun magit-git-exit-code (fmt &rest args)
|
||||||
(call-process shell-file-name nil nil nil
|
(call-process shell-file-name nil nil nil
|
||||||
shell-command-switch
|
shell-command-switch
|
||||||
(apply 'format cmd (mapcar #'magit-escape-for-shell args))))
|
(magit-format-git-command fmt args)))
|
||||||
|
|
||||||
(defun magit-file-lines (file)
|
(defun magit-file-lines (file)
|
||||||
(if (file-exists-p file)
|
(if (file-exists-p file)
|
||||||
(magit-shell-lines "cat %s" file)
|
(magit-shell-lines (magit-format-shell-command "cat %s" (list file)))
|
||||||
nil))
|
nil))
|
||||||
|
|
||||||
(defun magit-concat-with-delim (delim seqs)
|
(defun magit-concat-with-delim (delim seqs)
|
||||||
|
@ -224,31 +242,24 @@ Many Magit faces inherit from this one by default."
|
||||||
(concat (car seqs) delim (magit-concat-with-delim delim (cdr seqs))))))
|
(concat (car seqs) delim (magit-concat-with-delim delim (cdr seqs))))))
|
||||||
|
|
||||||
(defun magit-get (&rest keys)
|
(defun magit-get (&rest keys)
|
||||||
(magit-shell "%s config %s"
|
(magit-git-string "config %s" (magit-concat-with-delim "." keys)))
|
||||||
magit-git-executable
|
|
||||||
(magit-concat-with-delim "." keys)))
|
|
||||||
|
|
||||||
(defun magit-set (val &rest keys)
|
(defun magit-set (val &rest keys)
|
||||||
(if val
|
(if val
|
||||||
(magit-shell "%s config %s %s"
|
(magit-git-string "config %s %s" (magit-concat-with-delim "." keys) val)
|
||||||
magit-git-executable
|
(magit-git-string "config --unset %s" (magit-concat-with-delim "." keys))))
|
||||||
(magit-concat-with-delim "." keys) val)
|
|
||||||
(magit-shell "%s config --unset %s"
|
|
||||||
magit-git-executable
|
|
||||||
(magit-concat-with-delim "." keys))))
|
|
||||||
|
|
||||||
(defun magit-get-top-dir (cwd)
|
(defun magit-get-top-dir (cwd)
|
||||||
(let ((cwd (expand-file-name cwd)))
|
(let ((cwd (expand-file-name cwd)))
|
||||||
(and (file-directory-p cwd)
|
(and (file-directory-p cwd)
|
||||||
(let ((magit-dir (magit-shell
|
(let* ((default-dir cwd)
|
||||||
"cd %s && %s rev-parse --git-dir 2>/dev/null"
|
(magit-dir (magit-git-string "rev-parse --git-dir 2>/dev/null")))
|
||||||
cwd magit-git-executable)))
|
|
||||||
(and magit-dir
|
(and magit-dir
|
||||||
(file-name-as-directory
|
(file-name-as-directory
|
||||||
(or (file-name-directory magit-dir) cwd)))))))
|
(or (file-name-directory magit-dir) cwd)))))))
|
||||||
|
|
||||||
(defun magit-get-ref (ref)
|
(defun magit-get-ref (ref)
|
||||||
(magit-shell "%s symbolic-ref -q %s" magit-git-executable ref))
|
(magit-git-string "symbolic-ref -q %s" ref))
|
||||||
|
|
||||||
(defun magit-get-current-branch ()
|
(defun magit-get-current-branch ()
|
||||||
(let* ((head (magit-get-ref "HEAD"))
|
(let* ((head (magit-get-ref "HEAD"))
|
||||||
|
@ -264,8 +275,7 @@ Many Magit faces inherit from this one by default."
|
||||||
|
|
||||||
(defun magit-name-rev (rev)
|
(defun magit-name-rev (rev)
|
||||||
(and rev
|
(and rev
|
||||||
(let ((name (magit-shell "%s name-rev --name-only %s"
|
(let ((name (magit-git-string "name-rev --name-only %s" rev)))
|
||||||
magit-git-executable rev)))
|
|
||||||
(if (or (not name) (string= name "undefined"))
|
(if (or (not name) (string= name "undefined"))
|
||||||
rev
|
rev
|
||||||
name))))
|
name))))
|
||||||
|
@ -278,10 +288,7 @@ Many Magit faces inherit from this one by default."
|
||||||
(concat "'" (replace-regexp-in-string "'" "'\\''" str) "'"))
|
(concat "'" (replace-regexp-in-string "'" "'\\''" str) "'"))
|
||||||
|
|
||||||
(defun magit-format-commit (commit format)
|
(defun magit-format-commit (commit format)
|
||||||
(magit-shell "%s log --max-count=1 --pretty=format:%s %s"
|
(magit-git-string "log --max-count=1 --pretty=format:%s %s" format commit))
|
||||||
magit-git-executable
|
|
||||||
format
|
|
||||||
commit))
|
|
||||||
|
|
||||||
(defun magit-current-line ()
|
(defun magit-current-line ()
|
||||||
(buffer-substring-no-properties (line-beginning-position)
|
(buffer-substring-no-properties (line-beginning-position)
|
||||||
|
@ -299,24 +306,17 @@ Many Magit faces inherit from this one by default."
|
||||||
(insert text))))
|
(insert text))))
|
||||||
|
|
||||||
(defun magit-file-uptodate-p (file)
|
(defun magit-file-uptodate-p (file)
|
||||||
(eq (magit-shell-exit-code "%s diff --quiet -- %s"
|
(eq (magit-git-exit-code "diff --quiet -- %s" file) 0))
|
||||||
magit-git-executable file)
|
|
||||||
0))
|
|
||||||
|
|
||||||
(defun magit-anything-staged-p ()
|
(defun magit-anything-staged-p ()
|
||||||
(not (eq (magit-shell-exit-code "%s diff --quiet --cached"
|
(not (eq (magit-git-exit-code "diff --quiet --cached") 0)))
|
||||||
magit-git-executable)
|
|
||||||
0)))
|
|
||||||
|
|
||||||
(defun magit-everything-clean-p ()
|
(defun magit-everything-clean-p ()
|
||||||
(and (not (magit-anything-staged-p))
|
(and (not (magit-anything-staged-p))
|
||||||
(eq (magit-shell-exit-code "%s diff --quiet"
|
(eq (magit-git-exit-code "diff --quiet") 0)))
|
||||||
magit-git-executable)
|
|
||||||
0)))
|
|
||||||
|
|
||||||
(defun magit-commit-parents (commit)
|
(defun magit-commit-parents (commit)
|
||||||
(cdr (magit-shell-lines "%s rev-list -1 --parents %s | tr ' ' '\n'"
|
(cdr (magit-git-lines "rev-list -1 --parents %s | tr ' ' '\n'"
|
||||||
magit-git-executable
|
|
||||||
commit)))
|
commit)))
|
||||||
|
|
||||||
;; XXX - let the user choose the parent
|
;; XXX - let the user choose the parent
|
||||||
|
@ -336,8 +336,8 @@ Many Magit faces inherit from this one by default."
|
||||||
;;; Revisions and ranges
|
;;; Revisions and ranges
|
||||||
|
|
||||||
(defun magit-list-interesting-revisions ()
|
(defun magit-list-interesting-revisions ()
|
||||||
(append (magit-shell-lines "%s branch -a | cut -c3-" magit-git-executable)
|
(append (magit-git-lines "branch -a | cut -c3-")
|
||||||
(magit-shell-lines "%s tag" magit-git-executable)))
|
(magit-git-lines "tag")))
|
||||||
|
|
||||||
(defun magit-read-rev (prompt &optional def)
|
(defun magit-read-rev (prompt &optional def)
|
||||||
(let* ((prompt (if def
|
(let* ((prompt (if def
|
||||||
|
@ -552,6 +552,15 @@ Many Magit faces inherit from this one by default."
|
||||||
(insert "\n"))
|
(insert "\n"))
|
||||||
section))
|
section))
|
||||||
|
|
||||||
|
(defun magit-git-section (section-title-and-type
|
||||||
|
buffer-title washer &rest args)
|
||||||
|
(apply #'magit-insert-section
|
||||||
|
section-title-and-type
|
||||||
|
buffer-title
|
||||||
|
washer
|
||||||
|
magit-git-executable
|
||||||
|
(append magit-git-standard-options args)))
|
||||||
|
|
||||||
(defun magit-next-section (section)
|
(defun magit-next-section (section)
|
||||||
(let ((parent (magit-section-parent section)))
|
(let ((parent (magit-section-parent section)))
|
||||||
(if parent
|
(if parent
|
||||||
|
@ -869,7 +878,7 @@ Many Magit faces inherit from this one by default."
|
||||||
"\n")
|
"\n")
|
||||||
(cond (nowait
|
(cond (nowait
|
||||||
(setq magit-process
|
(setq magit-process
|
||||||
(apply 'start-process magit-git-executable buf cmd args))
|
(apply 'start-process cmd buf cmd args))
|
||||||
(set-process-sentinel magit-process 'magit-process-sentinel)
|
(set-process-sentinel magit-process 'magit-process-sentinel)
|
||||||
(set-process-filter magit-process 'magit-process-filter)
|
(set-process-filter magit-process 'magit-process-filter)
|
||||||
(when input
|
(when input
|
||||||
|
@ -944,20 +953,32 @@ Many Magit faces inherit from this one by default."
|
||||||
|
|
||||||
(defun magit-run-git (&rest args)
|
(defun magit-run-git (&rest args)
|
||||||
(magit-with-refresh
|
(magit-with-refresh
|
||||||
(magit-run* (cons magit-git-executable args))))
|
(magit-run* (append (cons magit-git-executable
|
||||||
|
magit-git-standard-options)
|
||||||
|
args))))
|
||||||
|
|
||||||
(defun magit-run-with-input (input cmd &rest args)
|
(defun magit-run-with-input (input cmd &rest args)
|
||||||
(magit-with-refresh
|
(magit-with-refresh
|
||||||
(magit-run* (cons cmd args) nil nil nil nil input)))
|
(magit-run* (cons cmd args) nil nil nil nil input)))
|
||||||
|
|
||||||
|
(defun magit-run-git-with-input (input &rest args)
|
||||||
|
(magit-with-refresh
|
||||||
|
(magit-run* (append (cons magit-git-executable
|
||||||
|
magit-git-standard-options)
|
||||||
|
args)
|
||||||
|
nil nil nil nil input)))
|
||||||
|
|
||||||
(defun magit-run-shell (fmt &rest args)
|
(defun magit-run-shell (fmt &rest args)
|
||||||
(let ((cmd (apply #'format fmt (mapcar #'magit-escape-for-shell args))))
|
(let ((cmd (apply #'format fmt (mapcar #'magit-escape-for-shell args))))
|
||||||
(magit-with-refresh
|
(magit-with-refresh
|
||||||
(magit-run* (list shell-file-name shell-command-switch cmd)
|
(magit-run* (list shell-file-name shell-command-switch cmd)
|
||||||
cmd))))
|
cmd))))
|
||||||
|
|
||||||
(defun magit-run-async (cmd &rest args)
|
(defun magit-run-git-async (&rest args)
|
||||||
(magit-run* (cons cmd args) nil nil nil t))
|
(magit-run* (append (cons magit-git-executable
|
||||||
|
magit-git-standard-options)
|
||||||
|
args)
|
||||||
|
nil nil nil t))
|
||||||
|
|
||||||
(defun magit-run-async-with-input (input cmd &rest args)
|
(defun magit-run-async-with-input (input cmd &rest args)
|
||||||
(magit-run* (cons cmd args) nil nil nil t input))
|
(magit-run* (cons cmd args) nil nil nil t input))
|
||||||
|
@ -1301,9 +1322,8 @@ Please see the manual for a complete description of Magit.
|
||||||
(magit-wash-sequence #'magit-wash-untracked-file))
|
(magit-wash-sequence #'magit-wash-untracked-file))
|
||||||
|
|
||||||
(defun magit-insert-untracked-files ()
|
(defun magit-insert-untracked-files ()
|
||||||
(magit-insert-section 'untracked "Untracked files:"
|
(magit-git-section 'untracked "Untracked files:"
|
||||||
'magit-wash-untracked-files
|
'magit-wash-untracked-files
|
||||||
magit-git-executable
|
|
||||||
"ls-files" "-t" "--others" "--exclude-standard"))
|
"ls-files" "-t" "--others" "--exclude-standard"))
|
||||||
|
|
||||||
;;; Diffs and Hunks
|
;;; Diffs and Hunks
|
||||||
|
@ -1535,8 +1555,8 @@ Please see the manual for a complete description of Magit.
|
||||||
(magit-insert-hunk-item-region-patch
|
(magit-insert-hunk-item-region-patch
|
||||||
hunk reverse (region-beginning) (region-end) tmp)
|
hunk reverse (region-beginning) (region-end) tmp)
|
||||||
(magit-insert-hunk-item-patch hunk tmp))
|
(magit-insert-hunk-item-patch hunk tmp))
|
||||||
(apply #'magit-run-with-input tmp
|
(apply #'magit-run-git-with-input tmp
|
||||||
magit-git-executable "apply" (append args (list "-")))))
|
"apply" (append args (list "-")))))
|
||||||
|
|
||||||
(defun magit-apply-hunk-item (hunk &rest args)
|
(defun magit-apply-hunk-item (hunk &rest args)
|
||||||
(apply #'magit-apply-hunk-item* hunk nil args))
|
(apply #'magit-apply-hunk-item* hunk nil args))
|
||||||
|
@ -1546,21 +1566,18 @@ Please see the manual for a complete description of Magit.
|
||||||
|
|
||||||
(defun magit-insert-unstaged-changes (title)
|
(defun magit-insert-unstaged-changes (title)
|
||||||
(let ((magit-hide-diffs t))
|
(let ((magit-hide-diffs t))
|
||||||
(magit-insert-section 'unstaged title 'magit-wash-diffs
|
(magit-git-section 'unstaged title 'magit-wash-diffs
|
||||||
magit-git-executable "diff"
|
"diff" (magit-diff-U-arg))))
|
||||||
(magit-diff-U-arg))))
|
|
||||||
|
|
||||||
(defun magit-insert-staged-changes (no-commit)
|
(defun magit-insert-staged-changes (no-commit)
|
||||||
(let ((magit-hide-diffs t))
|
(let ((magit-hide-diffs t))
|
||||||
(if no-commit
|
(if no-commit
|
||||||
(let ((null-tree (magit-shell "git mktree </dev/null")))
|
(let ((null-tree (magit-git-string "mktree </dev/null")))
|
||||||
(magit-insert-section 'staged "Staged changes:" 'magit-wash-diffs
|
(magit-git-section 'staged "Staged changes:" 'magit-wash-diffs
|
||||||
magit-git-executable "diff" "--cached"
|
"diff" "--cached" (magit-diff-U-arg)
|
||||||
(magit-diff-U-arg)
|
|
||||||
null-tree))
|
null-tree))
|
||||||
(magit-insert-section 'staged "Staged changes:" 'magit-wash-diffs
|
(magit-git-section 'staged "Staged changes:" 'magit-wash-diffs
|
||||||
magit-git-executable "diff" "--cached"
|
"diff" "--cached" (magit-diff-U-arg)))))
|
||||||
(magit-diff-U-arg)))))
|
|
||||||
|
|
||||||
;;; Logs and Commits
|
;;; Logs and Commits
|
||||||
|
|
||||||
|
@ -1622,9 +1639,9 @@ in log buffer."
|
||||||
|
|
||||||
(defun magit-refresh-commit-buffer (commit)
|
(defun magit-refresh-commit-buffer (commit)
|
||||||
(magit-create-buffer-sections
|
(magit-create-buffer-sections
|
||||||
(magit-insert-section nil nil
|
(magit-git-section nil nil
|
||||||
'magit-wash-commit
|
'magit-wash-commit
|
||||||
magit-git-executable "log" "--max-count=1"
|
"log" "--max-count=1"
|
||||||
"--pretty=medium"
|
"--pretty=medium"
|
||||||
"--cc" "-p" commit)))
|
"--cc" "-p" commit)))
|
||||||
|
|
||||||
|
@ -1683,15 +1700,15 @@ in log buffer."
|
||||||
(error "No commit marked")))
|
(error "No commit marked")))
|
||||||
|
|
||||||
(defun magit-insert-unpulled-commits (remote branch)
|
(defun magit-insert-unpulled-commits (remote branch)
|
||||||
(magit-insert-section 'unpulled
|
(magit-git-section 'unpulled
|
||||||
"Unpulled commits:" 'magit-wash-log
|
"Unpulled commits:" 'magit-wash-log
|
||||||
magit-git-executable "log" "--pretty=format:* %H %s"
|
"log" "--pretty=format:* %H %s"
|
||||||
(format "HEAD..%s/%s" remote branch)))
|
(format "HEAD..%s/%s" remote branch)))
|
||||||
|
|
||||||
(defun magit-insert-unpushed-commits (remote branch)
|
(defun magit-insert-unpushed-commits (remote branch)
|
||||||
(magit-insert-section 'unpushed
|
(magit-git-section 'unpushed
|
||||||
"Unpushed commits:" 'magit-wash-log
|
"Unpushed commits:" 'magit-wash-log
|
||||||
magit-git-executable "log" "--pretty=format:* %H %s"
|
"log" "--pretty=format:* %H %s"
|
||||||
(format "%s/%s..HEAD" remote branch)))
|
(format "%s/%s..HEAD" remote branch)))
|
||||||
|
|
||||||
;;; Status
|
;;; Status
|
||||||
|
@ -1701,9 +1718,8 @@ in log buffer."
|
||||||
(magit-with-section 'status nil
|
(magit-with-section 'status nil
|
||||||
(let* ((branch (magit-get-current-branch))
|
(let* ((branch (magit-get-current-branch))
|
||||||
(remote (and branch (magit-get "branch" branch "remote")))
|
(remote (and branch (magit-get "branch" branch "remote")))
|
||||||
(head (magit-shell
|
(head (magit-git-string
|
||||||
"%s log --max-count=1 --abbrev-commit --pretty=oneline"
|
"log --max-count=1 --abbrev-commit --pretty=oneline"))
|
||||||
magit-git-executable))
|
|
||||||
(no-commit (string-match "fatal: bad default revision" head)))
|
(no-commit (string-match "fatal: bad default revision" head)))
|
||||||
(if remote
|
(if remote
|
||||||
(insert (format "Remote: %s %s\n"
|
(insert (format "Remote: %s %s\n"
|
||||||
|
@ -1899,11 +1915,11 @@ in log buffer."
|
||||||
|
|
||||||
(defun magit-svn-rebase ()
|
(defun magit-svn-rebase ()
|
||||||
(interactive)
|
(interactive)
|
||||||
(magit-run-async magit-git-executable "svn" "rebase"))
|
(magit-run-git-async "svn" "rebase"))
|
||||||
|
|
||||||
(defun magit-svn-dcommit ()
|
(defun magit-svn-dcommit ()
|
||||||
(interactive)
|
(interactive)
|
||||||
(magit-run-async magit-git-executable "svn" "dcommit"))
|
(magit-run-git-async "svn" "dcommit"))
|
||||||
|
|
||||||
(defun magit-svn-enabled ()
|
(defun magit-svn-enabled ()
|
||||||
(not (null (find "git-svn" (magit-list-interesting-revisions) :test 'equal))))
|
(not (null (find "git-svn" (magit-list-interesting-revisions) :test 'equal))))
|
||||||
|
@ -1949,9 +1965,8 @@ in log buffer."
|
||||||
(used (plist-get properties 'used)))
|
(used (plist-get properties 'used)))
|
||||||
(magit-with-section commit 'commit
|
(magit-with-section commit 'commit
|
||||||
(magit-set-section-info commit)
|
(magit-set-section-info commit)
|
||||||
(insert (magit-shell
|
(insert (magit-git-string
|
||||||
"%s log --max-count=1 --pretty=format:%s %s --"
|
"log --max-count=1 --pretty=format:%s %s --"
|
||||||
magit-git-executable
|
|
||||||
(if used ". %s" "* %s")
|
(if used ". %s" "* %s")
|
||||||
commit)
|
commit)
|
||||||
"\n")))))
|
"\n")))))
|
||||||
|
@ -1983,11 +1998,10 @@ in log buffer."
|
||||||
(orig (cadr (assq 'orig info))))
|
(orig (cadr (assq 'orig info))))
|
||||||
(when orig
|
(when orig
|
||||||
(let ((magit-hide-diffs t))
|
(let ((magit-hide-diffs t))
|
||||||
(magit-insert-section 'pending-changes
|
(magit-git-section 'pending-changes
|
||||||
"Pending changes"
|
"Pending changes"
|
||||||
'magit-wash-diffs
|
'magit-wash-diffs
|
||||||
magit-git-executable "diff"
|
"diff" (magit-diff-U-arg) "-R" orig)))))
|
||||||
(magit-diff-U-arg) "-R" orig)))))
|
|
||||||
|
|
||||||
(defun magit-rewrite-start (from &optional onto)
|
(defun magit-rewrite-start (from &optional onto)
|
||||||
(interactive (list (magit-read-rev "Rewrite from" (magit-default-rev))))
|
(interactive (list (magit-read-rev "Rewrite from" (magit-default-rev))))
|
||||||
|
@ -1995,10 +2009,9 @@ in log buffer."
|
||||||
(error "You have uncommitted changes."))
|
(error "You have uncommitted changes."))
|
||||||
(or (not (magit-read-rewrite-info))
|
(or (not (magit-read-rewrite-info))
|
||||||
(error "Rewrite in progress."))
|
(error "Rewrite in progress."))
|
||||||
(let* ((orig (magit-shell "%s rev-parse HEAD" magit-git-executable))
|
(let* ((orig (magit-git-string "rev-parse HEAD"))
|
||||||
(base (magit-shell "%s rev-parse %s^" magit-git-executable from))
|
(base (magit-git-string "rev-parse %s^" from))
|
||||||
(pending (magit-shell-lines "%s rev-list %s.."
|
(pending (magit-git-lines "rev-list %s.." base)))
|
||||||
magit-git-executable base)))
|
|
||||||
(magit-write-rewrite-info `((orig ,orig)
|
(magit-write-rewrite-info `((orig ,orig)
|
||||||
(pending ,@(mapcar #'list pending))))
|
(pending ,@(mapcar #'list pending))))
|
||||||
(magit-run-git "reset" "--hard" base)))
|
(magit-run-git "reset" "--hard" base)))
|
||||||
|
@ -2050,19 +2063,19 @@ in log buffer."
|
||||||
|
|
||||||
(defun magit-remote-update ()
|
(defun magit-remote-update ()
|
||||||
(interactive)
|
(interactive)
|
||||||
(magit-run-async magit-git-executable "remote" "update")
|
(magit-run-git-async "remote" "update")
|
||||||
(if (magit-svn-enabled)
|
(if (magit-svn-enabled)
|
||||||
(magit-run-async magit-git-executable "svn" "fetch")))
|
(magit-run-git-async "svn" "fetch")))
|
||||||
|
|
||||||
(defun magit-pull ()
|
(defun magit-pull ()
|
||||||
(interactive)
|
(interactive)
|
||||||
(magit-run-async magit-git-executable "pull" "-v"))
|
(magit-run-git-async "pull" "-v"))
|
||||||
|
|
||||||
(defun magit-read-remote (prompt def)
|
(defun magit-read-remote (prompt def)
|
||||||
(completing-read (if def
|
(completing-read (if def
|
||||||
(format "%s (default %s): " prompt def)
|
(format "%s (default %s): " prompt def)
|
||||||
(format "%s: " prompt))
|
(format "%s: " prompt))
|
||||||
(magit-shell-lines "%s remote" magit-git-executable)
|
(magit-git-lines "remote")
|
||||||
nil nil nil nil def))
|
nil nil nil nil def))
|
||||||
|
|
||||||
(defun magit-push ()
|
(defun magit-push ()
|
||||||
|
@ -2078,7 +2091,7 @@ in log buffer."
|
||||||
(if (and (not branch-remote)
|
(if (and (not branch-remote)
|
||||||
(not current-prefix-arg))
|
(not current-prefix-arg))
|
||||||
(magit-set push-remote "branch" branch "remote"))
|
(magit-set push-remote "branch" branch "remote"))
|
||||||
(magit-run-async magit-git-executable "push" "-v" push-remote branch)))
|
(magit-run-git-async "push" "-v" push-remote branch)))
|
||||||
|
|
||||||
;;; Log edit mode
|
;;; Log edit mode
|
||||||
|
|
||||||
|
@ -2207,13 +2220,13 @@ Prefix arg means justify as well."
|
||||||
(let ((commit-buf (current-buffer)))
|
(let ((commit-buf (current-buffer)))
|
||||||
(with-current-buffer (magit-find-buffer 'status default-directory)
|
(with-current-buffer (magit-find-buffer 'status default-directory)
|
||||||
(cond (tag
|
(cond (tag
|
||||||
(magit-run-with-input
|
(magit-run-git-with-input commit-buf "tag" tag "-a" "-F" "-"))
|
||||||
commit-buf
|
|
||||||
magit-git-executable "tag" tag "-a" "-F" "-"))
|
|
||||||
(t
|
(t
|
||||||
(apply #'magit-run-async-with-input commit-buf
|
(apply #'magit-run-async-with-input commit-buf
|
||||||
magit-git-executable "commit" "-F" "-"
|
magit-git-executable
|
||||||
(append (if (not (or amend (magit-anything-staged-p)))
|
(append magit-git-standard-options
|
||||||
|
(list "commit" "-F" "-")
|
||||||
|
(if (not (or amend (magit-anything-staged-p)))
|
||||||
'("--all") '())
|
'("--all") '())
|
||||||
(if amend '("--amend") '())
|
(if amend '("--amend") '())
|
||||||
(if magit-commit-signoff
|
(if magit-commit-signoff
|
||||||
|
@ -2331,9 +2344,9 @@ Prefix arg means justify as well."
|
||||||
(magit-wash-sequence #'magit-wash-stash)))
|
(magit-wash-sequence #'magit-wash-stash)))
|
||||||
|
|
||||||
(defun magit-insert-stashes ()
|
(defun magit-insert-stashes ()
|
||||||
(magit-insert-section 'stashes
|
(magit-git-section 'stashes
|
||||||
"Stashes:" 'magit-wash-stashes
|
"Stashes:" 'magit-wash-stashes
|
||||||
magit-git-executable "stash" "list"))
|
"stash" "list"))
|
||||||
|
|
||||||
(defun magit-stash (description)
|
(defun magit-stash (description)
|
||||||
(interactive "sStash description: ")
|
(interactive "sStash description: ")
|
||||||
|
@ -2396,7 +2409,9 @@ Prefix arg means justify as well."
|
||||||
|
|
||||||
(defun magit-cherry-pick-commit (commit &optional noerase)
|
(defun magit-cherry-pick-commit (commit &optional noerase)
|
||||||
(let ((parent-id (magit-choose-parent-id commit "cherry-pick")))
|
(let ((parent-id (magit-choose-parent-id commit "cherry-pick")))
|
||||||
(magit-run* `(,magit-git-executable "cherry-pick"
|
(magit-run* `(,magit-git-executable
|
||||||
|
,@magit-git-standard-options
|
||||||
|
"cherry-pick"
|
||||||
,@(if parent-id
|
,@(if parent-id
|
||||||
(list "-m" (number-to-string parent-id)))
|
(list "-m" (number-to-string parent-id)))
|
||||||
,commit)
|
,commit)
|
||||||
|
@ -2458,25 +2473,24 @@ Prefix arg means justify as well."
|
||||||
|
|
||||||
(defun magit-configure-have-graph ()
|
(defun magit-configure-have-graph ()
|
||||||
(if (eq magit-have-graph 'unset)
|
(if (eq magit-have-graph 'unset)
|
||||||
(let ((res (magit-shell-exit-code "%s log --graph --max-count=0"
|
(let ((res (magit-git-exit-code "%s log --graph --max-count=0")))
|
||||||
magit-git-executable)))
|
|
||||||
(setq magit-have-graph (eq res 0)))))
|
(setq magit-have-graph (eq res 0)))))
|
||||||
|
|
||||||
(defun magit-configure-have-decorate ()
|
(defun magit-configure-have-decorate ()
|
||||||
(if (eq magit-have-decorate 'unset)
|
(if (eq magit-have-decorate 'unset)
|
||||||
(let ((res (magit-shell-exit-code "%s log --decorate --max-count=0"
|
(let ((res (magit-git-exit-code "log --decorate --max-count=0")))
|
||||||
magit-git-executable)))
|
|
||||||
(setq magit-have-decorate (eq res 0)))))
|
(setq magit-have-decorate (eq res 0)))))
|
||||||
|
|
||||||
(defun magit-refresh-log-buffer (range style args)
|
(defun magit-refresh-log-buffer (range style args)
|
||||||
(magit-configure-have-graph)
|
(magit-configure-have-graph)
|
||||||
(magit-configure-have-decorate)
|
(magit-configure-have-decorate)
|
||||||
(magit-create-buffer-sections
|
(magit-create-buffer-sections
|
||||||
(apply #'magit-insert-section nil
|
(apply #'magit-git-section nil
|
||||||
(magit-rev-range-describe range "Commits")
|
(magit-rev-range-describe range "Commits")
|
||||||
'magit-wash-log
|
'magit-wash-log
|
||||||
`(,magit-git-executable "log" ,(format "--max-count=%s"
|
`("log"
|
||||||
magit-log-cutoff-length) ,style
|
,(format "--max-count=%s" magit-log-cutoff-length)
|
||||||
|
,style
|
||||||
,@(if magit-have-decorate (list "--decorate"))
|
,@(if magit-have-decorate (list "--decorate"))
|
||||||
,@(if magit-have-graph (list "--graph"))
|
,@(if magit-have-graph (list "--graph"))
|
||||||
,args "--"))))
|
,args "--"))))
|
||||||
|
@ -2507,13 +2521,13 @@ Prefix arg means justify as well."
|
||||||
|
|
||||||
(defun magit-refresh-reflog-buffer (head args)
|
(defun magit-refresh-reflog-buffer (head args)
|
||||||
(magit-create-buffer-sections
|
(magit-create-buffer-sections
|
||||||
(magit-insert-section 'reflog
|
(magit-git-section 'reflog
|
||||||
(format "Local history of head %s" head)
|
(format "Local history of head %s" head)
|
||||||
'magit-wash-log
|
'magit-wash-log
|
||||||
magit-git-executable "log" "--walk-reflogs"
|
"log" "--walk-reflogs"
|
||||||
(format "--max-count=%s"
|
(format "--max-count=%s" magit-log-cutoff-length)
|
||||||
magit-log-cutoff-length)
|
"--pretty=oneline"
|
||||||
"--pretty=oneline" args)))
|
args)))
|
||||||
|
|
||||||
(defun magit-reflog (head)
|
(defun magit-reflog (head)
|
||||||
(interactive (list (magit-read-rev "Reflog of" "HEAD")))
|
(interactive (list (magit-read-rev "Reflog of" "HEAD")))
|
||||||
|
@ -2532,12 +2546,10 @@ Prefix arg means justify as well."
|
||||||
|
|
||||||
(defun magit-refresh-diff-buffer (range args)
|
(defun magit-refresh-diff-buffer (range args)
|
||||||
(magit-create-buffer-sections
|
(magit-create-buffer-sections
|
||||||
(magit-insert-section 'diffbuf
|
(magit-git-section 'diffbuf
|
||||||
(magit-rev-range-describe range "Changes")
|
(magit-rev-range-describe range "Changes")
|
||||||
'magit-wash-diffs
|
'magit-wash-diffs
|
||||||
magit-git-executable "diff"
|
"diff" (magit-diff-U-arg) args)))
|
||||||
(magit-diff-U-arg)
|
|
||||||
args)))
|
|
||||||
|
|
||||||
(defun magit-diff (range)
|
(defun magit-diff (range)
|
||||||
(interactive (list (magit-read-rev-range "Diff")))
|
(interactive (list (magit-read-rev-range "Diff")))
|
||||||
|
@ -2565,20 +2577,18 @@ Prefix arg means justify as well."
|
||||||
(magit-create-buffer-sections
|
(magit-create-buffer-sections
|
||||||
(magit-with-section 'wazzupbuf nil
|
(magit-with-section 'wazzupbuf nil
|
||||||
(insert (format "Wazzup, %s\n\n" head))
|
(insert (format "Wazzup, %s\n\n" head))
|
||||||
(let ((branches (magit-shell-lines "%s branch -a | cut -c3-"
|
(let ((branches (magit-git-lines "branch -a | cut -c3-")))
|
||||||
magit-git-executable)))
|
|
||||||
(dolist (b branches)
|
(dolist (b branches)
|
||||||
(let* ((n (magit-shell "%s log --pretty=oneline %s..%s | wc -l"
|
(let* ((n (magit-git-string "log --pretty=oneline %s..%s | wc -l"
|
||||||
magit-git-executable
|
|
||||||
head b))
|
head b))
|
||||||
(section
|
(section
|
||||||
(let ((magit-section-hidden-default t))
|
(let ((magit-section-hidden-default t))
|
||||||
(magit-insert-section
|
(magit-git-section
|
||||||
(cons b 'wazzup)
|
(cons b 'wazzup)
|
||||||
(format "%s unmerged commits in %s"
|
(format "%s unmerged commits in %s"
|
||||||
n b)
|
n b)
|
||||||
'magit-wash-log
|
'magit-wash-log
|
||||||
magit-git-executable "log"
|
"log"
|
||||||
(format "--max-count=%s" magit-log-cutoff-length)
|
(format "--max-count=%s" magit-log-cutoff-length)
|
||||||
"--pretty=oneline"
|
"--pretty=oneline"
|
||||||
(format "%s..%s" head b)
|
(format "%s..%s" head b)
|
||||||
|
@ -2621,7 +2631,7 @@ Prefix arg means justify as well."
|
||||||
(file (magit-diff-item-file diff)))
|
(file (magit-diff-item-file diff)))
|
||||||
(cond ((eq kind 'deleted)
|
(cond ((eq kind 'deleted)
|
||||||
(when (yes-or-no-p (format "Resurrect %s? " file))
|
(when (yes-or-no-p (format "Resurrect %s? " file))
|
||||||
(magit-shell "%s reset -q -- %s" magit-git-executable file)
|
(magit-run-git "reset" "-q" "--" file)
|
||||||
(magit-run-git "checkout" "--" file)))
|
(magit-run-git "checkout" "--" file)))
|
||||||
((eq kind 'new)
|
((eq kind 'new)
|
||||||
(if (yes-or-no-p (format "Delete %s? " file))
|
(if (yes-or-no-p (format "Delete %s? " file))
|
||||||
|
|
Loading…
Add table
Reference in a new issue