From: Stephen Berman <stephen.berman@gmx.net>
To: Davis Herring <herring@lanl.gov>
Cc: Mathias Megyei <mathias@mnet-mail.de>,
Emacs developers <emacs-devel@gnu.org>,
Yuri Khan <yuri.v.khan@gmail.com>
Subject: Re: git log question
Date: Thu, 30 Nov 2017 20:11:23 +0100 [thread overview]
Message-ID: <87a7z3d1k4.fsf@gmx.net> (raw)
In-Reply-To: <24a86127-902e-fa6e-cc64-154a6e6487e4@lanl.gov> (Davis Herring's message of "Thu, 30 Nov 2017 10:06:00 -0700")
Thanks for all the instructive responses. The magit and gitk displays
contain the information I want, but also much more than I want, and gitk
takes rather long to load, in addition to not being inside emacs (magit
I have yet to try). I've actually been using an Elisp command I defined
some time ago, but it didn't show the branches (because, as I mentioned
in my OP, I had (wrongly) assumed that `git log' only show commits on
the "branch" it is invoked on); I've now revised it to do that. Here it
is, for anyone who's interested:
(defun srb-git-log (&optional repo commit)
"Check REPO for COMMIT and if it exists, display its commit message.
Interactively, prompt for REPO, defaulting to emacs-master, and
for COMMIT, defaulting to the commit hash at point."
(interactive "p")
(let* ((git-dir (if repo
(read-directory-name "Repo: " "/mnt/data/steve/git/"
nil t "emacs-master")
"/mnt/data/steve/git/emacs-master"))
(commit0 (or commit (read-string "Commit: " nil nil (word-at-point))))
(default-directory git-dir)
(output-buffer (get-buffer-create "*git log*"))
(proc (progn
(with-current-buffer output-buffer (erase-buffer))
(call-process "git" nil output-buffer nil
"branch" "--contains" commit0))))
(when proc
(with-current-buffer output-buffer
(goto-char (point-min))
(unless (looking-at "[ *]")
(user-error "%s is not on branch %s" commit0
(file-name-base git-dir)))
(insert "Branches:\n")
(goto-char (point-max))
(call-process "git" nil output-buffer nil "log" "-1" commit0)
(pop-to-buffer output-buffer)))))
Steve Berman
next prev parent reply other threads:[~2017-11-30 19:11 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-30 10:00 git log question Stephen Berman
2017-11-30 11:30 ` Mathias Megyei
2017-11-30 12:02 ` Stephen Berman
2017-11-30 13:15 ` Yuri Khan
2017-11-30 14:19 ` Stephen Berman
2017-11-30 14:59 ` Noam Postavsky
2017-11-30 15:05 ` Yuri Khan
2017-11-30 15:05 ` Andreas Schwab
2017-11-30 15:21 ` Kaushal Modi
2017-11-30 15:25 ` Andreas Schwab
2017-11-30 15:35 ` Noam Postavsky
2017-11-30 17:46 ` Clément Pit-Claudel
2017-11-30 17:59 ` Kaushal Modi
2017-11-30 17:06 ` Davis Herring
2017-11-30 19:11 ` Stephen Berman [this message]
2017-11-30 14:28 ` Herring, Davis
2017-11-30 14:37 ` Stephen Berman
2017-11-30 15:57 ` Eli Zaretskii
2017-11-30 19:10 ` Stephen Berman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87a7z3d1k4.fsf@gmx.net \
--to=stephen.berman@gmx.net \
--cc=emacs-devel@gnu.org \
--cc=herring@lanl.gov \
--cc=mathias@mnet-mail.de \
--cc=yuri.v.khan@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).