git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* git log causing hang while browsing upstream linux
@ 2023-04-04 20:13 Rohit Ner
  2023-04-04 20:27 ` Kristoffer Haugsbakk
  0 siblings, 1 reply; 9+ messages in thread
From: Rohit Ner @ 2023-04-04 20:13 UTC (permalink / raw)
  To: git

Thank you for filling out a Git bug report!
Please answer the following questions to help us understand your issue.

What did you do before the bug happened? (Steps to reproduce your issue)
1. git clone https://github.com/torvalds/linux.git
2. git checkout master
3. git log --oneline --graph

What did you expect to happen? (Expected behavior)
See a graph of onelined commit histories

What happened instead? (Actual behavior)
Hang after entering the command

What's different between what you expected and what actually happened?
The output is empty and the cursor is stuck. Cursor is unresponsive to any key
press other than ^C which leads to an output like below
### OUTPUT START ###
...
~
~
~
~
(END)
### OUTPUT END ###
Pressing q key helps get the prompt back.

Anything else you want to add:

Please review the rest of the bug report below.
You can delete any lines you don't wish to share.


[System Info]
cpu: x86_64
no commit associated with this build
sizeof-long: 8
sizeof-size_t: 8
shell-path: /bin/sh
compiler info: gnuc: 12.2
libc info: glibc: 2.36
$SHELL (typically, interactive shell): /bin/bash


[Enabled Hooks]
commit-msg
pre-commit
prepare-commit-msg

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

* Re: git log causing hang while browsing upstream linux
  2023-04-04 20:13 git log causing hang while browsing upstream linux Rohit Ner
@ 2023-04-04 20:27 ` Kristoffer Haugsbakk
  2023-04-04 20:50   ` Kristoffer Haugsbakk
  0 siblings, 1 reply; 9+ messages in thread
From: Kristoffer Haugsbakk @ 2023-04-04 20:27 UTC (permalink / raw)
  To: Rohit Ner; +Cc: git

On Tue, Apr 4, 2023, at 22:13, Rohit Ner wrote:
> Thank you for filling out a Git bug report!
> Please answer the following questions to help us understand your issue.
>
> What did you do before the bug happened? (Steps to reproduce your issue)
> 1. git clone https://github.com/torvalds/linux.git
> 2. git checkout master
> 3. git log --oneline --graph

Seems like `--graph` is expensive.

FWIW: on my machine:

    $ time git log --oneline --graph | head -1 
    *   76f598ba7d8e Merge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm

    real	0m10.616s
    user	0m9.594s
    sys	0m0.654s

Second attempt is only marginally faster.

-- 
Kristoffer Haugsbakk

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

* Re: git log causing hang while browsing upstream linux
  2023-04-04 20:27 ` Kristoffer Haugsbakk
@ 2023-04-04 20:50   ` Kristoffer Haugsbakk
  2023-04-10 17:07     ` Rohit Ner
  0 siblings, 1 reply; 9+ messages in thread
From: Kristoffer Haugsbakk @ 2023-04-04 20:50 UTC (permalink / raw)
  To: Rohit Ner; +Cc: git

On Tue, Apr 4, 2023, at 22:27, Kristoffer Haugsbakk wrote:
> FWIW: on my machine:

So my point is: have you given the command a half a minute or so to
output the initial lines? Certain `log` invocations can take a long time
on repositories with rich histories.

-- 
Kristoffer Haugsbakk

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

* Re: git log causing hang while browsing upstream linux
  2023-04-04 20:50   ` Kristoffer Haugsbakk
@ 2023-04-10 17:07     ` Rohit Ner
  2023-04-11  0:00       ` Taylor Blau
  0 siblings, 1 reply; 9+ messages in thread
From: Rohit Ner @ 2023-04-10 17:07 UTC (permalink / raw)
  To: Kristoffer Haugsbakk; +Cc: git

I have not given the command more than 10 seconds, shouldn't the
intended behaviour be to render the visible subgraph first?

On Wed, Apr 5, 2023 at 2:21 AM Kristoffer Haugsbakk
<kristofferhaugsbakk@fastmail.com> wrote:
>
> On Tue, Apr 4, 2023, at 22:27, Kristoffer Haugsbakk wrote:
> > FWIW: on my machine:
>
> So my point is: have you given the command a half a minute or so to
> output the initial lines? Certain `log` invocations can take a long time
> on repositories with rich histories.
>
> --
> Kristoffer Haugsbakk

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

* Re: git log causing hang while browsing upstream linux
  2023-04-10 17:07     ` Rohit Ner
@ 2023-04-11  0:00       ` Taylor Blau
  2023-04-11  9:45         ` Kristoffer Haugsbakk
  2023-04-16  7:09         ` SZEDER Gábor
  0 siblings, 2 replies; 9+ messages in thread
From: Taylor Blau @ 2023-04-11  0:00 UTC (permalink / raw)
  To: Rohit Ner; +Cc: Kristoffer Haugsbakk, Derrick Stolee, git

On Mon, Apr 10, 2023 at 10:37:15PM +0530, Rohit Ner wrote:
> I have not given the command more than 10 seconds, shouldn't the
> intended behaviour be to render the visible subgraph first?

This is possible with Git's "commit-graph" feature, which you can read
about starting here:

		https://devblogs.microsoft.com/devops/supercharging-the-git-commit-graph/

TL;DR: if you run "git commit-graph write" once before running "git log
--oneline --graph", you'll get near-instantaneous results.

Thanks,
Taylor

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

* Re: git log causing hang while browsing upstream linux
  2023-04-11  0:00       ` Taylor Blau
@ 2023-04-11  9:45         ` Kristoffer Haugsbakk
  2023-04-16  7:09         ` SZEDER Gábor
  1 sibling, 0 replies; 9+ messages in thread
From: Kristoffer Haugsbakk @ 2023-04-11  9:45 UTC (permalink / raw)
  To: Taylor Blau, Rohit Ner; +Cc: Derrick Stolee, git

On Tue, Apr 11, 2023, at 02:00, Taylor Blau wrote:
> TL;DR: if you run "git commit-graph write" once before running "git log
> --oneline --graph", you'll get near-instantaneous results.

Cool! Testing on Linux repo:

Without it:

    $ time git log --oneline --graph | head -1
    *   0d3eb744aed4 Merge tag 'urgent-rcu.2023.04.07a' of git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu

    real	0m11.379s
    user	0m10.655s
    sys	0m0.726s

With it:

    $ time git log --oneline --graph | head -1
    *   0d3eb744aed4 Merge tag 'urgent-rcu.2023.04.07a' of git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu

    real	0m0.032s
    user	0m0.014s
    sys	0m0.023s

Maybe I’m gonna enable `git maintenance` for my repos. :)

-- 
Kristoffer Haugsbakk

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

* Re: git log causing hang while browsing upstream linux
  2023-04-11  0:00       ` Taylor Blau
  2023-04-11  9:45         ` Kristoffer Haugsbakk
@ 2023-04-16  7:09         ` SZEDER Gábor
  2023-04-16 12:46           ` How to write to the commit graph on clone? Kristoffer Haugsbakk
  1 sibling, 1 reply; 9+ messages in thread
From: SZEDER Gábor @ 2023-04-16  7:09 UTC (permalink / raw)
  To: Taylor Blau; +Cc: Rohit Ner, Kristoffer Haugsbakk, Derrick Stolee, git

On Mon, Apr 10, 2023 at 08:00:05PM -0400, Taylor Blau wrote:
> On Mon, Apr 10, 2023 at 10:37:15PM +0530, Rohit Ner wrote:
> > I have not given the command more than 10 seconds, shouldn't the
> > intended behaviour be to render the visible subgraph first?
> 
> This is possible with Git's "commit-graph" feature, which you can read
> about starting here:
> 
> 		https://devblogs.microsoft.com/devops/supercharging-the-git-commit-graph/
> 
> TL;DR: if you run "git commit-graph write"

Please never recommend 'git commit-graph write' without '--reachable';
scanning all packed objects to find commits to include in the
commit-graph is just too inefficient for that.

> once before running "git log
> --oneline --graph", you'll get near-instantaneous results.

The commit-graph has been enabled by default in v2.24.0, released over
three years ago.  I wonder why Rohit's and/or Kristoffer's repos
didn't have it already?!


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

* How to write to the commit graph on clone?
  2023-04-16  7:09         ` SZEDER Gábor
@ 2023-04-16 12:46           ` Kristoffer Haugsbakk
  2023-04-16 15:24             ` Ævar Arnfjörð Bjarmason
  0 siblings, 1 reply; 9+ messages in thread
From: Kristoffer Haugsbakk @ 2023-04-16 12:46 UTC (permalink / raw)
  To: SZEDER Gábor; +Cc: Rohit Ner, Derrick Stolee, git, Taylor Blau

> The commit-graph has been enabled by default in v2.24.0, released over
> three years ago.  I wonder why Rohit's and/or Kristoffer's repos
> didn't have it already?!

I might have done a fresh clone of Linux right before I replied to this
email thread, or else it might have just been lying around. (I don’t
work on Linux. ;)

I found out that I need to add this to my Git config in order for the
commit graph to be updated on `git fetch`, so I added it:

    [fetch]
            writeCommitGraph = true

I was wondering if this would help with cloning, so I did a fresh one:

    $ git clone https://github.com/torvalds/linux/ linux-github-2
    $ cd linux-github-2/
    $ time git log --oneline --graph | head -1
    *   3e7bb4f24617 Merge tag '6.3-rc6-smb311-client-negcontext-fix' of git://git.samba.org/sfrench/cifs-2.6

    real	0m10.364s
    user	0m9.700s
    sys	0m0.666s

So no.

But doing a `git fetch origin` fixed it:

    $ git fetch origin
    Expanding reachable commits in commit graph: 1171056, done.
    Writing out commit graph in 5 passes: 100% (5855280/5855280), done.
    $ time git log --oneline --graph | head -1
    *   3e7bb4f24617 Merge tag '6.3-rc6-smb311-client-negcontext-fix' of git://git.samba.org/sfrench/cifs-2.6

    real	0m0.017s
    user	0m0.007s
    sys	0m0.013s

Is there any config for writing to the commit graph on clone?

-- 
Kristoffer Haugsbakk

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

* Re: How to write to the commit graph on clone?
  2023-04-16 12:46           ` How to write to the commit graph on clone? Kristoffer Haugsbakk
@ 2023-04-16 15:24             ` Ævar Arnfjörð Bjarmason
  0 siblings, 0 replies; 9+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2023-04-16 15:24 UTC (permalink / raw)
  To: Kristoffer Haugsbakk
  Cc: SZEDER Gábor, Rohit Ner, Derrick Stolee, git, Taylor Blau


On Sun, Apr 16 2023, Kristoffer Haugsbakk wrote:

>> The commit-graph has been enabled by default in v2.24.0, released over
>> three years ago.  I wonder why Rohit's and/or Kristoffer's repos
>> didn't have it already?!
>
> I might have done a fresh clone of Linux right before I replied to this
> email thread, or else it might have just been lying around. (I don’t
> work on Linux. ;)
>
> I found out that I need to add this to my Git config in order for the
> commit graph to be updated on `git fetch`, so I added it:
>
>     [fetch]
>             writeCommitGraph = true
>
> I was wondering if this would help with cloning, so I did a fresh one:
>
>     $ git clone https://github.com/torvalds/linux/ linux-github-2
>     $ cd linux-github-2/
>     $ time git log --oneline --graph | head -1
>     *   3e7bb4f24617 Merge tag '6.3-rc6-smb311-client-negcontext-fix' of git://git.samba.org/sfrench/cifs-2.6
>
>     real	0m10.364s
>     user	0m9.700s
>     sys	0m0.666s
>
> So no.
>
> But doing a `git fetch origin` fixed it:
>
>     $ git fetch origin
>     Expanding reachable commits in commit graph: 1171056, done.
>     Writing out commit graph in 5 passes: 100% (5855280/5855280), done.
>     $ time git log --oneline --graph | head -1
>     *   3e7bb4f24617 Merge tag '6.3-rc6-smb311-client-negcontext-fix' of git://git.samba.org/sfrench/cifs-2.6
>
>     real	0m0.017s
>     user	0m0.007s
>     sys	0m0.013s
>
> Is there any config for writing to the commit graph on clone?

I don't think there is, but here's a lengthy discussion I started a
while ago about having some "on glone gc", which would cover this:
https://lore.kernel.org/git/87tvm3go42.fsf@evledraar.gmail.com/

I haven't re-read it just now, but if you're interested that should be a
good place to start.

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

end of thread, other threads:[~2023-04-16 15:25 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-04 20:13 git log causing hang while browsing upstream linux Rohit Ner
2023-04-04 20:27 ` Kristoffer Haugsbakk
2023-04-04 20:50   ` Kristoffer Haugsbakk
2023-04-10 17:07     ` Rohit Ner
2023-04-11  0:00       ` Taylor Blau
2023-04-11  9:45         ` Kristoffer Haugsbakk
2023-04-16  7:09         ` SZEDER Gábor
2023-04-16 12:46           ` How to write to the commit graph on clone? Kristoffer Haugsbakk
2023-04-16 15:24             ` Ævar Arnfjörð Bjarmason

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 NNTP newsgroup(s).