lazygit icon indicating copy to clipboard operation
lazygit copied to clipboard

Branch panel is empty

Open sankarraj-ps opened this issue 1 year ago • 12 comments

Describe the bug In some repositories, the local branch panel appears empty while all branches are visible in the CLI.

To Reproduce Steps to reproduce the behavior:

  1. Just open lazygit in particular repositories
  2. You can see the local branch panel is empty, but the commits are there.

Expected behavior Local Branches panel should contain list branches from local

Screenshots If applicable, add screenshots to help explain your problem. Screenshot 2024-09-09 at 5 44 00 PM

Version info: commit=71ad3fac63a3ef3326021837b49e9497d332818b, build date=2024-07-13T10:24:19Z, build source=binaryRelease, version=0.43.1, os=darwin, arch=amd64, git version=2.39.3 (Apple Git-146)

git version 2.39.3 (Apple Git-146)

Additional context Add any other context about the problem here.

Note: please try updating to the latest version or manually building the latest master to see if the issue still occurs.

sankarraj-ps avatar Sep 09 '24 12:09 sankarraj-ps

Btw, This tool is one of the best I have ever used for my development purposes.

Kudos and Thanks to everyone involved 🥇 ❤️

sankarraj-ps avatar Sep 09 '24 12:09 sankarraj-ps

Is one of those repositories a public one?

stefanhaller avatar Sep 09 '24 12:09 stefanhaller

Is one of those repositories a public one?

nope, they are private

sankarraj-ps avatar Sep 09 '24 13:09 sankarraj-ps

I'm experiencing this same issue after updating from 0.40.0 to 0.44.0

bbuff27 avatar Sep 11 '24 17:09 bbuff27

@bbuff27 Are you seeing this in a repo that you can share?

stefanhaller avatar Sep 11 '24 17:09 stefanhaller

Unfortunately, no I can't share the repo as it's a private business repo. Your comment did push me to check some other repos and they were working okay. Do you have any suggestions on how to troubleshoot myself?

bbuff27 avatar Sep 12 '24 20:09 bbuff27

I'm also seeing this, on all my private GitHub Repositories. It doesn't happen on public ones (e.g. I can clone the code for lazygit itself, and lazygit works fine in that repository).

I ran lazygit --debug and can see that I get an error when this bug happens, that doesn't appear on the public repositories:

Sep 13 10:38:29 |ERRO| 20:7: empty subsection name

And here's a full set of logs from launch, up to the error appearing (paths redacted):

Sep 13 10:43:22 |INFO| starting main loop
Sep 13 10:43:22 |INFO| Updating is currently not supported for windows until we can fix permission issues
Sep 13 10:43:22 |INFO| refreshing all scopes in async mode
Sep 13 10:43:22 |INFO| Refresh took 0s
Sep 13 10:43:22 |DEBU| RunCommand command="cmd /c title <redacted:repo name> - Lazygit"
Sep 13 10:43:22 |DEBU| RunCommand command="git fetch --all --no-write-fetch-head"
Sep 13 10:43:22 |DEBU| RunCommand command="git stash list -z --pretty=%ct|%gs"
Sep 13 10:43:22 |DEBU| RunCommand command="git rev-parse --abbrev-ref --verify HEAD"
Sep 13 10:43:22 |DEBU| RunCommand command="git for-each-ref --sort=-committerdate --format=%(HEAD)%00%(refname:short)%00%(upstream:short)%00%(upstream:track)%00%(push:track)%00%(subject)%00%(objectname)%00%(committerdate:unix) refs/heads"
Sep 13 10:43:22 |DEBU| RunCommand command="git tag --list -n --sort=-creatordate"
Sep 13 10:43:22 |DEBU| RunCommand command="git merge-base HEAD refs/remotes/origin/main"
Sep 13 10:43:22 |INFO| git merge-base HEAD refs/remotes/origin/main (69.0255ms)
Sep 13 10:43:22 |DEBU| using cache for key rebase.updateRefs
Sep 13 10:43:22 |INFO| postRefreshUpdate for commits took 1.0602ms
Sep 13 10:43:22 |DEBU| using cache for key rebase.updateRefs
Sep 13 10:43:22 |DEBU| RunCommand command="git for-each-ref --sort=-committerdate --format=%(HEAD)%00%(refname:short)%00%(upstream:short)%00%(upstream:track)%00%(push:track)%00%(subject)%00%(objectname)%00%(committerdate:unix) refs/heads"
Sep 13 10:43:22 |INFO| git for-each-ref --sort=-committerdate --format=%(HEAD)%00%(refname:short)%00%(upstream:short)%00%(upstream:track)%00%(push:track)%00%(subject)%00%(objectname)%00%(committerdate:unix) refs/heads (70.9617ms)
Sep 13 10:43:22 |ERRO| 20:7: empty subsection name

rbrunt avatar Sep 13 '24 09:09 rbrunt

@rbrunt Thanks for investigating.

It looks like there's a syntax error in your repo's local .git/config file (at line 20), my guess is that it contains something like [remote ""] or [branch ""] there.

I can reproduce the problem on my end if I add such an entry to mine. I'll have a look if there's anything we can do on our side to handle this more gracefully.

stefanhaller avatar Sep 13 '24 10:09 stefanhaller

@stefanhaller great spot: I can confirm that there is. Looking at my problematic repos, it's because there's an entry like the following:

[snyk ""]
	baseBranch = 

Removing this from .git/config fixes the issue in lazygit.

I suspect this is being added by the synk VSCode plugin, but need to confirm that....

If there's a way to handle this more gracefully in lazygit, that would be great (other clients don't seem to be affected), but I'll see if I can raise this with Synk too...

rbrunt avatar Sep 13 '24 10:09 rbrunt

@stefanhaller To confirm, after finding the same in my .git/config as @rbrunt, I also resolved the problem by removing those lines.

bbuff27 avatar Sep 13 '24 17:09 bbuff27

Just bumped into this; was able to quickly debug thanks to comments. In my case the offending part of .git/config was:

[url "[email protected]:"] insteadOf = https://github.com/

which I changed to:

[url "[email protected]:"]
	insteadOf = https://github.com/

Kos avatar May 06 '25 08:05 Kos

To add another example of something that can trigger this, I use gitextensions/gitextensions and I had "hidden" a repository (a feature of GitExtensions repository manager gui) which seems to achieve this by generating the following:

[-remote "origin-example"]
        url = [email protected]:my-namespace/example-repo.git
        fetch = +refs/heads/*:refs/remotes/origin-example/*

Which results in the logs:

Nov 27 17:52:58 |ERRO| <no msg> command="git rev-parse --verify --quiet refs/heads/master"
Nov 27 17:52:58 |INFO| git rev-parse --verify --quiet refs/heads/master (18.6135ms)
Nov 27 17:52:58 |DEBU| RunCommand command="git rev-list refs/heads/main ^main@{u} ^refs/remotes/origin/main"
Nov 27 17:52:58 |DEBU| RunCommand command="git rev-list HEAD ^refs/remotes/origin/main"
Nov 27 17:52:58 |INFO| git rev-list HEAD ^refs/remotes/origin/main (22.8474ms)
Nov 27 17:52:58 |INFO| git rev-list refs/heads/main ^main@{u} ^refs/remotes/origin/main (22.8474ms)
Nov 27 17:52:58 |DEBU| using cache for key rebase.updateRefs
Nov 27 17:52:58 |INFO| postRefreshUpdate for commits took 525µs
Nov 27 17:52:58 |DEBU| using cache for key rebase.updateRefs
Nov 27 17:52:58 |DEBU| using cache for key rebase.updateRefs
Nov 27 17:53:04 |DEBU| RunCommand command="git fetch --all --no-write-fetch-head"
Nov 27 17:53:07 |INFO| git -c log.showSignature=false log -g --format=+%H%x00%ct%x00%gs%x00%P (27.1511ms)
Nov 27 17:53:07 |INFO| git for-each-ref --sort=-committerdate --format=%(HEAD)%00%(refname:short)%00%(upstream:short)%00%(upstream:track)%00%(push:track)%00%(subject)%00%(objectname)%00%(committerdate:unix) refs/heads (27.1511ms)
Nov 27 17:53:07 |INFO| postRefreshUpdate for reflogCommits took 0s
Nov 27 17:53:07 |INFO| refreshed reflog in 28.3462ms
-Nov 27 17:53:07 |ERRO| 13:2: illegal character U+002D '-'
Nov 27 17:53:07 |INFO| postRefreshUpdate for localBranches took 0s
Nov 27 17:53:07 |INFO| git tag --list -n --sort=-creatordate (27.6653ms)
Nov 27 17:53:07 |INFO| postRefreshUpdate for tags took 0s
Nov 27 17:53:07 |INFO| refreshed tags in 28.8604ms
Nov 27 17:53:07 |INFO| git for-each-ref --sort=-committerdate --format=%(refname) refs/remotes (28.1931ms)
Nov 27 17:53:07 |INFO| git rev-list HEAD ^refs/remotes/origin/main (23.5238ms)
Nov 27 17:53:07 |INFO| git log HEAD --topo-order --oneline --pretty=format:+%H%x00%at%x00%aN%x00%ae%x00%P%x00%m%x00%D%x00%s --abbrev=40 -300 --no-show-signature -- (24.5676ms)
Nov 27 17:53:07 |INFO| git rev-list refs/heads/main ^main@{u} ^refs/remotes/origin/main (25.0983ms)
Nov 27 17:53:07 |DEBU| using cache for key rebase.updateRefs
Nov 27 17:53:07 |INFO| postRefreshUpdate for commits took 0s
Nov 27 17:53:07 |INFO| refreshed commits and commit files in 50.7797ms
Nov 27 17:53:07 |DEBU| using cache for key rebase.updateRefs
Nov 27 17:53:07 |INFO| refreshed branches in 50.7797ms
Nov 27 17:53:07 |INFO| Refresh took 50.7797ms
Nov 27 17:53:07 |DEBU| using cache for key rebase.updateRefs
Nov 27 17:53:08 |INFO| Heap memory in use: 4.9 MB

NOTE: The - at the start of the illegal character line wasn't in the log, I added it and marked the log as "diff" so I can highlight the important line.

jetwiwo avatar Nov 27 '25 06:11 jetwiwo