Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8 second hang running gitu - can't find .git/MERGE_HEAD #271

Open
idmyn opened this issue Oct 23, 2024 · 5 comments
Open

8 second hang running gitu - can't find .git/MERGE_HEAD #271

idmyn opened this issue Oct 23, 2024 · 5 comments

Comments

@idmyn
Copy link

idmyn commented Oct 23, 2024

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 🤔

@idmyn
Copy link
Author

idmyn commented Oct 23, 2024

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 🙏🏻

@altsem
Copy link
Owner

altsem commented Oct 23, 2024

@idmyn hmm that's not good!
Do you have any pre-commit hooks running?

And are you running off of master?
Try gitu --version

@idmyn
Copy link
Author

idmyn commented Oct 23, 2024

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

@altsem
Copy link
Owner

altsem commented Oct 24, 2024

Hard to tell what's going on here. 🤔
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.

@idmyn
Copy link
Author

idmyn commented Nov 13, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants