ohmyzsh: Oh My Zsh hangs after update when displaying the changelog

Describe the bug

After running oh-my-zsh automatic update, the command hangs and starts printing a long list of git logs after a while.

See the outputs here: https://app.warp.dev/block/KqshGhrLdrilLmwq3P2im5

Steps to reproduce

  1. cd $ZSH
  2. Get to an old state git reset --hard HEAD~10
  3. Run omz update

Expected behavior

The automatic update command should bootstrap.

Screenshots and recordings

https://share.getcloudapp.com/04u5PY8r

OS / Distro

macOS 11.4

Zsh version

5.8

Terminal emulator

iTerm2

If using WSL on Windows, which version of WSL

No response

Additional context

No response

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 16 (9 by maintainers)

Commits related to this issue

Most upvoted comments

OK, looks like somehow the merge commit we made recently got you a partially disjointed commit graph, where some commits from the merge commit were older than the first commit of the shallow clone:

* 1e5e834e - (HEAD -> master, origin/master, origin/HEAD) fix(cli): exit `omz update` with correct error code (#10342) (hace 2 horas) <Sina Tak Tehrani>
* f1dd97bb - fix(ssh-agent): fix check for running `ssh-agent` process with hidepid /proc (#8492) (hace 3 días) <Marc Cornellà>
* 46f8765f - feat(osx): add `freespace` command to clean purgeable disk space (#8762) (hace 5 días) <Rob Vadai>
* 8c1495a1 - fix(ruby)!: rename aliases that start with `g` to `ge` (hace 5 días) <Marc Cornellà>
* 4b1f6d63 - feat(ruby): add multiple `gem` aliases (#9005) (hace 6 días) <Marc Cornellà>
*   6f4c7f64 - Merge branch 'royninja-patch-1' (hace 6 días) <Robby Russell>
|\  
| * f83bb65d - Swapping gh with ghlp as 'gh' is reserved for the Github CLI. #9005 (hace 6 días) <Robby Russell>
| * a6b5aede - Merge branch 'patch-1' of https://github.com/royninja/ohmyzsh into royninja-patch-1 (hace 6 días) <Robby Russell>
|/| 
| * e751d251 - spacing changed (1 año, y 4 meses atrás) <Sayan Roy>
| * c268d176 - Updating the README.md (1 año, y 5 meses atrás) <Sayan Roy>
| * edbd86cd - Updating some gem command reference (1 año, y 5 meses atrás) <Sayan Roy>
| * <more commits until the very beginning of the project>
* <more commits until the first commit when Oh My Zsh was installed>
* (grafted) <commit when first installed>

The last commit you see in this partially redacted commit graph tells you that the repo is a shallow clone (you see grafted when the commit is a squashed version of all the parent commits).

I solved this by unshallow-ing the repository, with the following command:

git -C "$ZSH" fetch --unshallow

This downloads all the commit objects so that the two branches of the merge commit (6f4c7f64) are now connected. After that, the git rev-list command properly returns the 10 commits of difference.

I disabled merge commits in the project so that this doesn’t happen again, and I’ll push a fix so that the changelog doesn’t process more than N commits so it doesn’t hang indefinitely.