all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* git log question
@ 2017-11-30 10:00 Stephen Berman
  2017-11-30 11:30 ` Mathias Megyei
                   ` (2 more replies)
  0 siblings, 3 replies; 19+ messages in thread
From: Stephen Berman @ 2017-11-30 10:00 UTC (permalink / raw)
  To: emacs-devel

I thought if I call `git log <commit> -1' on the current branch, it will
only show <commit> if it is in the current branch, but I just discovered
this is not so: I called it with master current and <commit> being one I
knew was only in emacs-26, but nevertheless it showed that commit.  The
same thing with `git log --branches=master <commit> -1' and `git log
--branches="master" <commit> -1' (I couldn't tell from the doc if the
branch name should be quoted, but it made no difference).  What's the
required incantation?  Thanks.

Steve Berman



^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: git log question
  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 14:28 ` Herring, Davis
  2017-11-30 15:57 ` Eli Zaretskii
  2 siblings, 1 reply; 19+ messages in thread
From: Mathias Megyei @ 2017-11-30 11:30 UTC (permalink / raw)
  To: emacs-devel; +Cc: Stephen Berman

On 11/30/2017 11:00 AM, Stephen Berman wrote:
> I thought if I call `git log <commit> -1' on the current branch, it will
> only show <commit> if it is in the current branch,

When you want to know whether <commit> (originally committed to 
emacs-26) has been merged into master or any other local branch then you 
can use
   git branch --contains <commit>
In order to list remote tracking branches please add option '-r'
   git branch -r --contains <commit>

Mathias



^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: git log question
  2017-11-30 11:30 ` Mathias Megyei
@ 2017-11-30 12:02   ` Stephen Berman
  2017-11-30 13:15     ` Yuri Khan
  0 siblings, 1 reply; 19+ messages in thread
From: Stephen Berman @ 2017-11-30 12:02 UTC (permalink / raw)
  To: Mathias Megyei; +Cc: emacs-devel

On Thu, 30 Nov 2017 12:30:07 +0100 Mathias Megyei <mathias@mnet-mail.de> wrote:

> On 11/30/2017 11:00 AM, Stephen Berman wrote:
>> I thought if I call `git log <commit> -1' on the current branch, it will
>> only show <commit> if it is in the current branch,
>
> When you want to know whether <commit> (originally committed to emacs-26) has
> been merged into master or any other local branch then you can use
>   git branch --contains <commit>
> In order to list remote tracking branches please add option '-r'
>   git branch -r --contains <commit>

Thanks, but that doesn't answer my question.  I want to call `git
<command> <commit>' on a branch and see the commit only if it is indeed
on that branch, not on some other branch in the repository.  From your
reply, it appears that git does not have such a command, but I have to
first call `git branch --contains <commit>' and, if it shows the branch
I want, then call `git log <commit> -1'.  If so, fine, though a bit
disappointing it's not more straightforward.

Steve Berman



^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: git log question
  2017-11-30 12:02   ` Stephen Berman
@ 2017-11-30 13:15     ` Yuri Khan
  2017-11-30 14:19       ` Stephen Berman
  0 siblings, 1 reply; 19+ messages in thread
From: Yuri Khan @ 2017-11-30 13:15 UTC (permalink / raw)
  To: Stephen Berman; +Cc: Mathias Megyei, Emacs developers

On Thu, Nov 30, 2017 at 7:02 PM, Stephen Berman <stephen.berman@gmx.net> wrote:

> I want to call `git
> <command> <commit>' on a branch and see the commit only if it is indeed
> on that branch, not on some other branch in the repository.  From your
> reply, it appears that git does not have such a command, but I have to
> first call `git branch --contains <commit>' and, if it shows the branch
> I want, then call `git log <commit> -1'.  If so, fine, though a bit
> disappointing it's not more straightforward.

You are trying to do two things at once: (1) determine if a commit is
reachable from a branch, and (2) show the commit. But it seems Git
does not have a command to do exactly that, or any means to intersect
revision ranges in one command.

This works:

    $ git merge-base --is-ancestor <commit> HEAD && git log -1 <commit>

You might be able to define a Git alias to shorten it further.



^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: git log question
  2017-11-30 13:15     ` Yuri Khan
@ 2017-11-30 14:19       ` Stephen Berman
  2017-11-30 14:59         ` Noam Postavsky
                           ` (3 more replies)
  0 siblings, 4 replies; 19+ messages in thread
From: Stephen Berman @ 2017-11-30 14:19 UTC (permalink / raw)
  To: Yuri Khan; +Cc: Mathias Megyei, Emacs developers

On Thu, 30 Nov 2017 20:15:51 +0700 Yuri Khan <yuri.v.khan@gmail.com> wrote:

> On Thu, Nov 30, 2017 at 7:02 PM, Stephen Berman <stephen.berman@gmx.net> wrote:
>
>> I want to call `git
>> <command> <commit>' on a branch and see the commit only if it is indeed
>> on that branch, not on some other branch in the repository.  From your
>> reply, it appears that git does not have such a command, but I have to
>> first call `git branch --contains <commit>' and, if it shows the branch
>> I want, then call `git log <commit> -1'.  If so, fine, though a bit
>> disappointing it's not more straightforward.
>
> You are trying to do two things at once: (1) determine if a commit is
> reachable from a branch, and (2) show the commit. 

I'm not sure what you mean by "reachable from a branch"; what I want is
to find out whether a specific commit (identified by its hash) exists on
the current branch -- not just whether it exists on some branch in the
current repository -- and if so, to see that commit.

>                                                   But it seems Git
> does not have a command to do exactly that, or any means to intersect
> revision ranges in one command.
>
> This works:
>
>     $ git merge-base --is-ancestor <commit> HEAD && git log -1 <commit>
>
> You might be able to define a Git alias to shorten it further.

Thanks, but this does do what I want.  For example, when I invoke `git
branch --contains b407c521f2' on emacs-26 (here currently at
408862f02a), it outputs `master', but when I invoke `git merge-base
--is-ancestor b407c521f2 HEAD && git log -1 b407c521f2' on emacs-26, it
outputs nothing; though when I invoke this on emacs-master (here
currently at f069ea4f84), it does ouput that commit.

I find the following puzzling:

steve [ ~/git/emacs-master ]$ git log --oneline | grep b407c521f2
b407c521f2 Remove pinentry.el

steve [ ~/git/emacs-26 ]$ git log --oneline | grep b407c521f2

The latter gives no output; yet:

steve [ ~/git/emacs-26 ]$ git log --oneline b407c521f2 -1
b407c521f2 Remove pinentry.el

That is, `git log' invoked with a specific commit will find that commit
even when it's not on the current branch but on another branch in this
repository, but it appears unable to say which branch it's on.

Steve Berman



^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: git log question
  2017-11-30 10:00 git log question Stephen Berman
  2017-11-30 11:30 ` Mathias Megyei
@ 2017-11-30 14:28 ` Herring, Davis
  2017-11-30 14:37   ` Stephen Berman
  2017-11-30 15:57 ` Eli Zaretskii
  2 siblings, 1 reply; 19+ messages in thread
From: Herring, Davis @ 2017-11-30 14:28 UTC (permalink / raw)
  To: Stephen Berman, emacs-devel@gnu.org

> The same thing with `git log --branches=master <commit> -1'
> and `git log --branches="master" <commit> -1' (I couldn't tell
> from the doc if the branch name should be quoted, but it
> made no difference).

Quoting is handled by the shell (except perhaps on Windows).  Since branch names never have characters in them that are special to the shell (by design of Git), the quoting does nothing.

Davis


^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: git log question
  2017-11-30 14:28 ` Herring, Davis
@ 2017-11-30 14:37   ` Stephen Berman
  0 siblings, 0 replies; 19+ messages in thread
From: Stephen Berman @ 2017-11-30 14:37 UTC (permalink / raw)
  To: Herring, Davis; +Cc: emacs-devel@gnu.org

On Thu, 30 Nov 2017 14:28:51 +0000 "Herring, Davis" <herring@lanl.gov> wrote:

>> The same thing with `git log --branches=master <commit> -1'
>> and `git log --branches="master" <commit> -1' (I couldn't tell
>> from the doc if the branch name should be quoted, but it
>> made no difference).
>
> Quoting is handled by the shell (except perhaps on Windows).  Since branch
> names never have characters in them that are special to the shell (by design
> of Git), the quoting does nothing.

Thanks for clarifying (I should have thought of that myself, oh well).

Steve Berman



^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: git log question
  2017-11-30 14:19       ` Stephen Berman
@ 2017-11-30 14:59         ` Noam Postavsky
  2017-11-30 15:05         ` Yuri Khan
                           ` (2 subsequent siblings)
  3 siblings, 0 replies; 19+ messages in thread
From: Noam Postavsky @ 2017-11-30 14:59 UTC (permalink / raw)
  To: Stephen Berman; +Cc: Mathias Megyei, Emacs developers, Yuri Khan

On Thu, Nov 30, 2017 at 9:19 AM, Stephen Berman <stephen.berman@gmx.net> wrote:

> I'm not sure what you mean by "reachable from a branch"; what I want is
> to find out whether a specific commit (identified by its hash) exists on
> the current branch -- not just whether it exists on some branch in the
> current repository -- and if so, to see that commit.

git doesn't really have branches like you are talking about, it just
has movable tags.

> That is, `git log' invoked with a specific commit will find that commit
> even when it's not on the current branch but on another branch in this
> repository, but it appears unable to say which branch it's on.

'git log <commit>' means "show all commits starting with <commit>
going backwards".
'git log' is just a short form for 'git log HEAD' (i.e., the commit
you are currently on).



^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: git log question
  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 17:06         ` Davis Herring
  3 siblings, 0 replies; 19+ messages in thread
From: Yuri Khan @ 2017-11-30 15:05 UTC (permalink / raw)
  To: Stephen Berman; +Cc: Mathias Megyei, Emacs developers

> I'm not sure what you mean by "reachable from a branch"; what I want is
> to find out whether a specific commit (identified by its hash) exists on
> the current branch -- not just whether it exists on some branch in the
> current repository -- and if so, to see that commit.

A Git repository is a directed acyclic graph of commits, each next
commit referencing the previous. The word “reachable” is used in its
usual graph theory meaning: that there exists a path that starts at
the head of the current branch, follows this child–parent
relationships, and ends in the commit you are interested in.

If you have a graphical display handy, run this:

    $ gitk master emacs-26 b407c521f2

It will show you how the graph is structured.

On a text-only terminal, this is an acceptable substitute for gitk:

    $ git log --oneline --graph master emacs-26 b407c521f2



^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: git log question
  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 17:06         ` Davis Herring
  3 siblings, 1 reply; 19+ messages in thread
From: Andreas Schwab @ 2017-11-30 15:05 UTC (permalink / raw)
  To: Stephen Berman; +Cc: Mathias Megyei, Emacs developers, Yuri Khan

On Nov 30 2017, Stephen Berman <stephen.berman@gmx.net> wrote:

> Thanks, but this does do what I want.  For example, when I invoke `git
> branch --contains b407c521f2' on emacs-26 (here currently at
> 408862f02a), it outputs `master', but when I invoke `git merge-base
> --is-ancestor b407c521f2 HEAD && git log -1 b407c521f2' on emacs-26, it
> outputs nothing;

That's correct, b407c521f2 is only reachable from master.  So this is
exactly what you were looking for.

> That is, `git log' invoked with a specific commit will find that commit

Git lets you process any valid commit in your repository.  That's a
feature.  All commits in your repository are alike, no matter how they
are named.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."



^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: git log question
  2017-11-30 15:05         ` Andreas Schwab
@ 2017-11-30 15:21           ` Kaushal Modi
  2017-11-30 15:25             ` Andreas Schwab
                               ` (2 more replies)
  0 siblings, 3 replies; 19+ messages in thread
From: Kaushal Modi @ 2017-11-30 15:21 UTC (permalink / raw)
  To: Andreas Schwab
  Cc: Mathias Megyei, Yuri Khan, Stephen Berman, Emacs developers

[-- Attachment #1: Type: text/plain, Size: 1602 bytes --]

On Thu, Nov 30, 2017 at 10:06 AM Andreas Schwab <schwab@linux-m68k.org>
wrote:

> On Nov 30 2017, Stephen Berman <stephen.berman@gmx.net> wrote:
>
> > Thanks, but this does do what I want.  For example, when I invoke `git
> > branch --contains b407c521f2' on emacs-26 (here currently at
> > 408862f02a), it outputs `master', but when I invoke `git merge-base
> > --is-ancestor b407c521f2 HEAD && git log -1 b407c521f2' on emacs-26, it
> > outputs nothing;
>
> That's correct, b407c521f2 is only reachable from master.  So this is
> exactly what you were looking for.
>

I am just chiming in to mention Magit as I am surprised why no one else has
mentioned it yet.

See how easy it is to figure out such things (and many more git things) in
Magit:

1. Do M-x magit-status in emacs repo
2. Hit 'lb' to view the log of all branches (that gives the buffer on the
left you see in the below image).
3. C-s b407c521f2 (the commit you are interested in).
4. Hit RET
5. Boom! The commit details show up in the buffer you see in the right in
the below linked image. Notice the yellow highlighted "master". Only
"master" and few other branches are listed there.. but *not* "emacs-26". So
that commit is only on "master". If a commit were on both branches, both
would be listed on that row.

And the image..https://i.imgur.com/ec9izl4.png

That is one way to do that.. you could have alternatively just follow the
branching graphics/ascii art in that log view buffer to figure out that
that commit was only on origin/master and not on origin/emacs-26.

(no need to memorize cryptic git commands)
-- 

Kaushal Modi

[-- Attachment #2: Type: text/html, Size: 2649 bytes --]

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: git log question
  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
  2 siblings, 0 replies; 19+ messages in thread
From: Andreas Schwab @ 2017-11-30 15:25 UTC (permalink / raw)
  To: Kaushal Modi; +Cc: Mathias Megyei, Yuri Khan, Stephen Berman, Emacs developers

On Nov 30 2017, Kaushal Modi <kaushal.modi@gmail.com> wrote:

> 1. Do M-x magit-status in emacs repo
> 2. Hit 'lb' to view the log of all branches (that gives the buffer on the
> left you see in the below image).
> 3. C-s b407c521f2 (the commit you are interested in).
> 4. Hit RET

gitk b407c521f2

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."



^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: git log question
  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
  2 siblings, 0 replies; 19+ messages in thread
From: Noam Postavsky @ 2017-11-30 15:35 UTC (permalink / raw)
  To: Kaushal Modi
  Cc: Mathias Megyei, Emacs developers, Stephen Berman, Andreas Schwab,
	Yuri Khan

On Thu, Nov 30, 2017 at 10:21 AM, Kaushal Modi <kaushal.modi@gmail.com> wrote:

> 1. Do M-x magit-status in emacs repo
> 2. Hit 'lb' to view the log of all branches (that gives the buffer on the
> left you see in the below image).
> 3. C-s b407c521f2 (the commit you are interested in).
> 4. Hit RET

If you already have the commit hash, you could just do M-x
magit-show-commit b407c521f2 RET



^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: git log question
  2017-11-30 10:00 git log question Stephen Berman
  2017-11-30 11:30 ` Mathias Megyei
  2017-11-30 14:28 ` Herring, Davis
@ 2017-11-30 15:57 ` Eli Zaretskii
  2017-11-30 19:10   ` Stephen Berman
  2 siblings, 1 reply; 19+ messages in thread
From: Eli Zaretskii @ 2017-11-30 15:57 UTC (permalink / raw)
  To: Stephen Berman; +Cc: emacs-devel

> From: Stephen Berman <stephen.berman@gmx.net>
> Date: Thu, 30 Nov 2017 11:00:54 +0100
> 
> I thought if I call `git log <commit> -1' on the current branch, it will
> only show <commit> if it is in the current branch, but I just discovered
> this is not so: I called it with master current and <commit> being one I
> knew was only in emacs-26, but nevertheless it showed that commit.

Isn't that because we merge from emacs-26 to master, and that commit
was merged as part of that?



^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: git log question
  2017-11-30 14:19       ` Stephen Berman
                           ` (2 preceding siblings ...)
  2017-11-30 15:05         ` Andreas Schwab
@ 2017-11-30 17:06         ` Davis Herring
  2017-11-30 19:11           ` Stephen Berman
  3 siblings, 1 reply; 19+ messages in thread
From: Davis Herring @ 2017-11-30 17:06 UTC (permalink / raw)
  To: Stephen Berman, Yuri Khan; +Cc: Mathias Megyei, Emacs developers

(All these commands have been given by others in this thread; this 
message aims to better relate them to the questions asked.)

> I find the following puzzling:
> 
> steve [ ~/git/emacs-master ]$ git log --oneline | grep b407c521f2
> b407c521f2 Remove pinentry.el
> 
> steve [ ~/git/emacs-26 ]$ git log --oneline | grep b407c521f2
> 
> The latter gives no output; yet:

This command of course answers your original question: "Is commit C on 
branch B?".  You could use "grep -q" to make it a test, but "git 
merge-base --is-ancestor C B" is more efficient.

> steve [ ~/git/emacs-26 ]$ git log --oneline b407c521f2 -1
> b407c521f2 Remove pinentry.el
> 
> That is, `git log' invoked with a specific commit will find that commit
> even when it's not on the current branch but on another branch in this
> repository,

"git log" == "git log HEAD"; "git log X" reports X itself and all 
commits in its history.

> but it appears unable to say which branch it's on.

This is a different, dual question: "Which branches contain commit C?", 
for which the command is "git branch [-r|-a] --contains C".

Davis

-- 
This product is sold by volume, not by mass.  If it appears too dense or 
too sparse, it is because mass-energy conversion has occurred during 
shipping.



^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: git log question
  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
  2 siblings, 1 reply; 19+ messages in thread
From: Clément Pit-Claudel @ 2017-11-30 17:46 UTC (permalink / raw)
  To: Kaushal Modi, Andreas Schwab
  Cc: Mathias Megyei, Stephen Berman, Emacs developers, Yuri Khan

On 2017-11-30 10:21, Kaushal Modi wrote:
> 3. C-s b407c521f2 (the commit you are interested in).

That usually doesn't work in my experience (Magit doesn't show all commits in the log, only the last ~250).

Clément.



^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: git log question
  2017-11-30 17:46             ` Clément Pit-Claudel
@ 2017-11-30 17:59               ` Kaushal Modi
  0 siblings, 0 replies; 19+ messages in thread
From: Kaushal Modi @ 2017-11-30 17:59 UTC (permalink / raw)
  To: Clément Pit-Claudel
  Cc: Mathias Megyei, Emacs developers, Stephen Berman, Andreas Schwab,
	Yuri Khan

[-- Attachment #1: Type: text/plain, Size: 849 bytes --]

On Thu, Nov 30, 2017 at 12:46 PM Clément Pit-Claudel <cpitclaudel@gmail.com>
wrote:

> On 2017-11-30 10:21, Kaushal Modi wrote:
> > 3. C-s b407c521f2 (the commit you are interested in).
>
> That usually doesn't work in my experience (Magit doesn't show all commits
> in the log, only the last ~250).
>

That of course was a "quick and dirty way". I mentioned this approach
because it was about sleuthing a recent commit.

'lb' has now become a goto to do all sorts of things: branching, merging,
cherry picking, interactive rebase, quickly doing n/p in the log to see
commit details in the other window.. and this particular use case fit in
too..

YMMW, but the first thing I do almost always after M-x magit-status is lb
followed by fa.

Also, the method Noam mentioned is spot on: M-x magit-show-commi.
-- 

Kaushal Modi

[-- Attachment #2: Type: text/html, Size: 1315 bytes --]

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: git log question
  2017-11-30 15:57 ` Eli Zaretskii
@ 2017-11-30 19:10   ` Stephen Berman
  0 siblings, 0 replies; 19+ messages in thread
From: Stephen Berman @ 2017-11-30 19:10 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

On Thu, 30 Nov 2017 17:57:59 +0200 Eli Zaretskii <eliz@gnu.org> wrote:

>> From: Stephen Berman <stephen.berman@gmx.net>
>> Date: Thu, 30 Nov 2017 11:00:54 +0100
>> 
>> I thought if I call `git log <commit> -1' on the current branch, it will
>> only show <commit> if it is in the current branch, but I just discovered
>> this is not so: I called it with master current and <commit> being one I
>> knew was only in emacs-26, but nevertheless it showed that commit.
>
> Isn't that because we merge from emacs-26 to master, and that commit
> was merged as part of that?

No, this was prior to that commit being merged to master (cf. my example
of a commit existing only on master but being shown when invoking `git
log <commit>' on emacs-26).

Steve Berman



^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: git log question
  2017-11-30 17:06         ` Davis Herring
@ 2017-11-30 19:11           ` Stephen Berman
  0 siblings, 0 replies; 19+ messages in thread
From: Stephen Berman @ 2017-11-30 19:11 UTC (permalink / raw)
  To: Davis Herring; +Cc: Mathias Megyei, Emacs developers, Yuri Khan

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



^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2017-11-30 19:11 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.