git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Rémi Vanicat <vanicat@debian.org>
Date
Mar 28, 2008, 16:53 UTC
Message-ID
<87bq4ydc3d.dlv@maison.homelinux.org>

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
Message 1 of 1 in “git.el: Add a git-log command”
  1. git.el: Add a git-log commandRémi Vanicat, Mar 28, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.