[PATCH/RFC] git.el: Add a git-log command

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The git-log-files command only give log relative to selected files, or
relative to the file under cursor if there is no selected files, so
git.el could not give the full log.  This new command do it.

There is no key-binding for now.
---
Do I need a key binding for this? No idea where to put it. 
Another way to do it may be to use a prefix arg to git-log-file

 contrib/emacs/git.el |   16 +++++++++++-----
 1 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/contrib/emacs/git.el b/contrib/emacs/git.el
index 4fa853f..6cf55dc 100644
--- a/contrib/emacs/git.el
+++ b/contrib/emacs/git.el
@@ -1191,11 +1191,10 @@ Return the list of files that haven't been handled."
            (buff2 (git-run-command-buffer (concat filename ".~HEAD~") "cat-file" "blob" (concat "HEAD:" filename))))
       (ediff-buffers buff1 buff2))))
 
-(defun git-log-file ()
+(defun git-log-file (files)
   "Display a log of changes to the marked file(s)."
-  (interactive)
-  (let* ((files (git-marked-files))
-         (coding-system-for-read git-commits-coding-system)
+  (interactive (list (git-marked-files)))
+  (let* ((coding-system-for-read git-commits-coding-system)
          (buffer (apply #'git-run-command-buffer "*git-log*" "rev-list" "--pretty" "HEAD" "--" (git-get-filenames files))))
     (with-current-buffer buffer
       ; (git-log-mode)  FIXME: implement log mode
@@ -1203,6 +1202,11 @@ Return the list of files that haven't been handled."
       (setq buffer-read-only t))
     (display-buffer buffer)))
 
+(defun git-log ()
+  "Display a log of changes."
+  (interactive)
+  (git-log-file ()))
+
 (defun git-log-edit-files ()
   "Return a list of marked files for use in the log-edit buffer."
   (with-current-buffer log-edit-parent-buffer
@@ -1495,7 +1499,9 @@ amended version of it."
       ["View File" git-view-file t]
       ["Diff File" git-diff-file t]
       ["Interactive Diff File" git-diff-file-idiff t]
-      ["Log" git-log-file t]
+      ["Log file" git-log-file t]
+      ["Log" git-log t]
+      ,@(if (featurep 'grep) (list ["Grep" git-grep t]) ())
       "--------"
       ["Mark" git-mark-file t]
       ["Mark All" git-mark-all t]
-- 
1.5.5.rc0.19.g4b856


--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux