8 second hang running gitu - can't find .git/MERGE_HEAD
Hey I ADORE this tool and use it countless times throughout my day
I'm sure there's an easy fix for this issue on my end but figured it was worth flagging here in case others run into it...
I'm seeing an 8s delay when running gitu in one of my repos (blank terminal, but then the interface appears and it works smoothly, though operations like staging & unstaging files take a second or two). Here's the output from gitu --log
[00:00:00.000] (1f2163240) DEBUG Initializing terminal backend
[00:00:00.000] (1f2163240) DEBUG Starting app
[00:00:00.000] (1f2163240) DEBUG Finding git dir
[00:00:00.008] (1f2163240) DEBUG Opening repo
[00:00:00.009] (1f2163240) DEBUG Initializing config
[00:00:00.009] (1f2163240) INFO Loading config file at "/Users/david/.config/gitu/config.toml"
[00:00:00.010] (1f2163240) DEBUG Creating initial state
[00:00:00.068] (1f2163240) WARN Couldn't read /Users/david/src/work/console-fe/.git/rebase-merge/onto, due to No such file or directory (os error 2)
[00:00:00.068] (1f2163240) WARN Couldn't read /Users/david/src/work/console-fe/.git/MERGE_HEAD, due to No such file or directory (os error 2)
[00:00:00.068] (1f2163240) WARN Couldn't read /Users/david/src/work/console-fe/.git/REVERT_HEAD, due to No such file or directory (os error 2)
[00:00:08.187] (1f2163240) DEBUG Initial update
[00:00:08.189] (1f2163240) TRACE registering event source with poller: token=Token(0), interests=READABLE
[00:00:08.190] (1f2163240) TRACE registering event source with poller: token=Token(1), interests=READABLE
I've check and gitu is working normally in other repos.
Any suggestions about the best way to rectify this without re-cloning the repo? git seems to be working fine 🤔
Ah, after making a commit using git from the command line it seems to have fixed itself 🤔
~My best guess is that my repo was in a funny state because I'd updated git (and gitu) last night and somehow completing an operation with the new git version did some kind of cleanup~
~Happy to close this issue unless you've got any followup questions for me~
EDIT: it's happening again in the same repo after some more git ops (commits/pushes on different branches mainly). Let me know if there's any more debug steps I can do when my repo gets in this state 🙏🏻
@idmyn hmm that's not good! Do you have any pre-commit hooks running?
And are you running off of master?
Try gitu --version
gitu --version is gitu 0.25.0 (installed via nix)
don't think I have any pre-commit hooks (there's husky in the repo but I've disabled it with an environment variable)
output of ls .git/hooks is
applypatch-msg.sample
commit-msg.sample
fsmonitor-watchman.sample
post-update.sample
pre-applypatch.sample
pre-commit.sample
pre-merge-commit.sample
pre-push.sample
pre-rebase.sample
pre-receive.sample
prepare-commit-msg.sample
push-to-checkout.sample
update.sample
and gitu.log from the same repo when it's running smoothly:
[00:00:00.000] (1f2163240) DEBUG Initializing terminal backend
[00:00:00.000] (1f2163240) DEBUG Starting app
[00:00:00.000] (1f2163240) DEBUG Finding git dir
[00:00:00.008] (1f2163240) DEBUG Opening repo
[00:00:00.009] (1f2163240) DEBUG Initializing config
[00:00:00.009] (1f2163240) INFO Loading config file at "/Users/david/.config/gitu/config.toml"
[00:00:00.010] (1f2163240) DEBUG Creating initial state
[00:00:00.078] (1f2163240) WARN Couldn't read /Users/david/src/work/console-fe/.git/rebase-merge/onto, due to No such file or directory (os error 2)
[00:00:00.078] (1f2163240) WARN Couldn't read /Users/david/src/work/console-fe/.git/MERGE_HEAD, due to No such file or directory (os error 2)
[00:00:00.078] (1f2163240) WARN Couldn't read /Users/david/src/work/console-fe/.git/REVERT_HEAD, due to No such file or directory (os error 2)
[00:00:00.130] (1f2163240) DEBUG Initial update
[00:00:00.132] (1f2163240) TRACE registering event source with poller: token=Token(0), interests=READABLE
[00:00:00.132] (1f2163240) TRACE registering event source with poller: token=Token(1), interests=READABLE
Hard to tell what's going on here. :thinking: Does work in this repo involve a lot of diffing files / maybe large binary files? Does it contain git submodules?
Every time an action is taken, the UI (and internal state) is updated with the current state of git. So my guess is that this process becomes too slow for some reason.
Pressing g does exactly this, a refresh.
I haven't run into this issue since the day I reported it, so that's good! But doesn't help with pinning down the root cause...
I didn't do anything intentionally to fix it, but just now I got this output from a git pull which might shed some light:
Auto packing the repository in background for optimum performance.
See "git help gc" for manual housekeeping.
warning: The last gc run reported the following. Please correct the root cause
and remove .git/gc.log
Automatic cleanup will not be performed until the file is removed.
warning: There are too many unreachable loose objects; run 'git prune' to remove them.
and to answer your questions:
- number of tracked files = 2597
- no large binary files AFAIK
- no git submodules
Hello, I ran into the same problem on one of my repositories.
[00:00:00.000] (7afb4df10900) DEBUG Initializing terminal backend
[00:00:00.000] (7afb4df10900) DEBUG Starting app
[00:00:00.001] (7afb4df10900) DEBUG Finding git dir
[00:00:00.005] (7afb4df10900) DEBUG Opening repo
[00:00:00.038] (7afb4df10900) DEBUG Initializing config
[00:00:00.038] (7afb4df10900) INFO Loading config file at "/home/gael/.config/gitu/config.toml"
[00:00:00.039] (7afb4df10900) DEBUG Creating initial state
[00:00:07.223] (7afb4df10900) WARN Couldn't read /srv/http/formadmin/.git/rebase-merge/onto, due to No such file or directory (os error 2)
[00:00:07.223] (7afb4df10900) WARN Couldn't read /srv/http/formadmin/.git/MERGE_HEAD, due to No such file or directory (os error 2)
[00:00:07.223] (7afb4df10900) WARN Couldn't read /srv/http/formadmin/.git/REVERT_HEAD, due to No such file or directory (os error 2)
[00:00:14.037] (7afb4df10900) DEBUG Initial update
[00:00:14.037] (7afb41bff6c0) TRACE Started serve requests thread.
[00:00:14.039] (7afb4df10900) TRACE registering event source with poller: token=Token(0), interests=READABLE
[00:00:14.039] (7afb4df10900) TRACE registering event source with poller: token=Token(1), interests=READABLE
[00:00:29.403] (7afb41bff6c0) TRACE Clipboard server window is being destroyed x_x
For me, it take a large amount of time (around 10 to 15 secondes) when Creating initial state. There are no submodules.
There are arround 50,000 files on this project, it probably is the issue:
Even a git status take a bit of time (1 to 3 seconds).
So the real issue would me more likely to show something while processing files. Because it's hard to tell if the app is running or not.
EDIT: I got it working properly after doing the following command in my repo:
git config feature.manyFiles true
git update-index --index-version 4
git config core.fsmonitor true
Hello, I am currently running into that problem as well with one of my repositories.
I have exactly 58 files in my repo, but I do have a couple of heavy ones. When using the tools of git and diskusage, this is what I get:
git ls-tree -r --long HEAD | awk '{sum+=$4} END {print sum}'
3601447
du -sh .
3.1G
I have tried to start gitu, but it failed after a couple of minutes.
This is what I got when I use gitu --log:
[00:00:00.000] (7fe2c14caf80) DEBUG Initializing terminal backend
[00:00:00.000] (7fe2c14caf80) DEBUG Starting app
[00:00:00.000] (7fe2c14caf80) DEBUG Finding git dir
[00:00:00.001] (7fe2c14caf80) DEBUG Opening repo
[00:00:00.003] (7fe2c14caf80) DEBUG Initializing config
[00:00:00.003] (7fe2c14caf80) INFO No config file at ".config/gitu/config.toml"
[00:00:00.004] (7fe2c14caf80) DEBUG Creating initial state
[00:00:00.022] (7fe2c14caf80) WARN Couldn't read .git/rebase-merge/onto, due to No such file or directory (os error 2)
[00:00:00.022] (7fe2c14caf80) WARN Couldn't read .git/MERGE_HEAD, due to No such file or directory (os error 2)
[00:00:00.022] (7fe2c14caf80) WARN Couldn't read .git/REVERT_HEAD, due to No such file or directory (os error 2)
I tried the commands proposed by Gael, but no luck, I got the same result.
I don't know how the devs did it, but lazygit opens up instantly with the same exact repository.
Edit: Latest version (v0.30.3) seems to have fix partially this problem. gitu opens much faster and blocks less.